Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

topics with no same-name command give odd help info #555

Closed
rossiam opened this issue Nov 15, 2022 · 2 comments
Closed

topics with no same-name command give odd help info #555

rossiam opened this issue Nov 15, 2022 · 2 comments

Comments

@rossiam
Copy link

rossiam commented Nov 15, 2022

Describe the bug

When I have a topic that does not have a same-name command, the help output produced for the topic describes a command in the topic rather than being generic to the topic.

To Reproduce
Steps to reproduce the behavior:

  1. Clone the topic-test repository.
  2. Build it by running npm install && npm build.
  3. Run ./bin/run topic-only --help to see help for the topic that has no same-name command associated with it.
  4. See error

Expected behavior
The description at the top should mention this is a topic only and there should be no USAGE stanza. Ideally the description would be configurable somehow.

Screenshots
If applicable, add screenshots to help explain your problem.

Environment (please complete the following information):

  • OS & version: MacOS and Linux for sure but I don't think this is an OS-specific thing.

Additional context
Perhaps there is already a way to fix this? We use oclif in the SmartThings CLI and have this problem there. We have an edge topic but no edge command. For now, I've created an edge command that has a description of edge topic and just displays a message asking the user run --help.

SmartThingsCommunity/smartthings-cli#444

@rossiam rossiam changed the title topic with no same-name command give odd help info topics with no same-name command give odd help info Jan 25, 2023
@mdonnalley
Copy link
Contributor

@rossiam

The usage section in this case indicates that you can use the topic by specifying a sub command,

USAGE
  $ topic-test topic-only COMMAND

I believe this is a valid usage string so I'm not convinced that we should get rid of it but I'm open to hearing arguments about why it should.

Also, the description for the topic can be configured by adding it to the oclif section of your package.json. For instance,

"oclif": {
"topics": {
      "topic-only": {
        "description": "This topic has no top-level command"
      }
    }
}

@rossiam
Copy link
Author

rossiam commented Mar 16, 2023

Thanks for the help. I wasn't aware of the configuration in package.json. I'm closing this although I still think there is room for improvement. A couple of errors I made in the original description of this:

  1. I shouldn't have said there "there should be no USAGE stanza" stanza under expected behavior. The default USAGE stanza is describing the sub-commands perfectly. It's only the description that is off.
  2. I should have defined "same-name command". What I mean by this is a topic with no index.ts and no <topic-name>.ts like topic-only in the example.
  3. I could have been more clear that I think the current behavior is correct when there is a same-name command. For example, the topic topic-and-command produces a good description. I just think the default description for a topic with no same-name command should be different or even left out entirely.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants