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

User can set a description for their custom command that shows up when executing :ls #142

Open
joebwan opened this issue May 2, 2017 · 8 comments
Assignees

Comments

@joebwan
Copy link
Contributor

joebwan commented May 2, 2017

The builtin commands have descriptions but custom ones do not.

It would be nice to be able to do something like this:
ssh alpha.cmd.io :create ambiguous "not anymore"
ssh alpha.cmd.io :create ambiguous2 "much less so"

Then the :ls command would show something like:

☰ Commands
  ambiguous      not anymore
  ambiguous2     much less so
@progrium
Copy link
Contributor

progrium commented May 2, 2017

Great catch, we had this in before but we lost it while moving things around. I actually think this should be a flag as opposed to positional argument. I tend to avoid flags, but I'm pretty sure :create is going to require a second arg of - to indicate using STDIN. In the future, not providing - may open an editor. But since this is optional and not necessary for basic use, it can be a flag. What do you think?

@joebwan
Copy link
Contributor Author

joebwan commented May 2, 2017

The Command struct appears to support Description and have null handling <new_to_go/>
Not sure how to test this patch locally:

$ git diff app/builtin/create.go 
diff --git a/app/builtin/create.go b/app/builtin/create.go
index 52f5780..fc4582a 100644
--- a/app/builtin/create.go
+++ b/app/builtin/create.go
@@ -48,6 +48,7 @@ var createCmd = func(sess cli.Session) *cobra.Command {
                                Name:   args[0],
                                User:   sess.User(),
                                Source: string(source),
+                               Description:   args[1],
                        }
 
                        if err := cmd.Build(); err != nil {

@joebwan
Copy link
Contributor Author

joebwan commented May 2, 2017

No objection to a flag here. I'll need to dig through src more to find out where that would be handled.

@progrium
Copy link
Contributor

progrium commented May 2, 2017

Feel free to ask plenty of questions in slack.

@joebwan
Copy link
Contributor Author

joebwan commented May 3, 2017

Any preference on the name, usage or shorthand for this flag?

@joebwan joebwan self-assigned this May 3, 2017
@progrium
Copy link
Contributor

progrium commented May 3, 2017

--description, -d

@joebwan
Copy link
Contributor Author

joebwan commented May 3, 2017

https://github.com/gliderlabs/cmd/tree/joebwan_exp includes a patch worth review. At the moment I'm unable to test locally but make clean && make build succeed.

@joebwan
Copy link
Contributor Author

joebwan commented May 10, 2017

96de3f8 is tested locally

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