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

Consistency for tab - behavior #167

Closed
TheTeXnician opened this issue Oct 5, 2020 · 3 comments
Closed

Consistency for tab - behavior #167

TheTeXnician opened this issue Oct 5, 2020 · 3 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@TheTeXnician
Copy link

When running tab - (think of forgetting thel after it 😉) I get the following output

error: Found argument '-/' which wasn't expected, or isn't valid in this context

USAGE:
    tab [FLAGS] [OPTIONS] [--] [TAB]

For more information try --help

which I would read as an illegal action resulting in a failure. Much to my surprise, however, a tab named - is generated and switched to. tab -l then shows

Available tabs:
    -/

Would it be possible to either

  • disable the error if - is a valid tab name,
  • turn the error into an informational message that a tab named - was created and that maybe this wasn't what the user intended to do or
  • forbid the - tab name?

Many thanks for providing this nice tool.

@austinjones austinjones added the enhancement New feature or request label Oct 5, 2020
@austinjones austinjones added this to the 0.4.0 milestone Oct 5, 2020
@austinjones
Copy link
Owner

Ah, good catch. Clap is parsing tab - as a positional argument, and tab -/ as a flag with the short name /.

I think forbidding tab names that start with a hyphen is a good idea, as even if it got past this step, the name could be shadowed by CLI flags.

I'm glad you like the tool! And thanks for the feature request :)

@austinjones
Copy link
Owner

austinjones commented Oct 6, 2020

I've implemented this in #170. I'll update & close the issue once 0.4.0 is released.

The behavior is now:

$ tab -
error: Invalid value for '<TAB>': tab name may not begin with a dash

It's still possible to define invalid tab names in YAML config, and I added #169 to help with that.

@austinjones austinjones self-assigned this Oct 7, 2020
@austinjones
Copy link
Owner

Closing, v0.4.0 is released!

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

No branches or pull requests

2 participants