Skip to content

help command shouldn't emit error messages as if I'm running the command #323

Closed

Description

@mairaw

Steps to reproduce

Run dotnet new <template_name> --help on a folder that already has a project.

Expected behavior

It would list the syntax for the command I'm asking.

Actual behavior

It's giving me an error because the folder already has a project.
image

Environment data

dotnet --info output:
.NET Command Line Tools (1.0.0-rc4-004788)

Product Information:
Version: 1.0.0-rc4-004788
Commit SHA-1 hash: f2ad5a39ab

Runtime Environment:
OS Name: Windows
OS Version: 10.0.14393
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\1.0.0-rc4-004788

Activity

  1. seancpeters commented on Feb 15, 2017

    @seancpeters

    @mlorbetske @sayedihashimi
    For this situation, I'm thinking we should show help for the specific template if either:

    1. The template specification is unambiguous within the current context.
    2. The template specification is unambiguous ignoring context. But when the context is wrong, we should still show the context mismatch message - the first output in the screenshot.

    Thoughts?

  2. mlorbetske commented on Feb 25, 2017

    @mlorbetske

    In the release following RTW, contexts will no longer switch implicitly but can be set explicitly via --type {project/item/other}.

    While this error message will still show, it will only show in a case where a project template or item template is selected but has been explicitly filtered out. The list of templates that are valid in the context will also be shown instead of the empty grid.

  3. mairaw commented on Mar 1, 2017

    @mairaw
    Author

    @mlorbetske I don't quite understand the change you're describing, but I don't get why I'd still get the error. I shouldn't get the error if what I'm requesting is to see help.

  4. mlorbetske commented on Mar 1, 2017

    @mlorbetske

    With the change, dotnet new mvc -h will not produce an error no matter what directory you're in. This is because we've removed the automatic switching of "contexts" where we'd go into showing/using item templates (gets rid of the confusing circumstance where dotnet new web executed twice in the same place has different results). This filtering is now explicit, so you can specify dotnet new --list --type project or dotnet new --list --type item to see just project templates or item templates respectively. Now, if you combine the type switch and a template instead of the list switch, let's say "dotnet new mvc --type item --help", you'll see an error that says that mvc is not an item template & to try again without the --type switch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions