Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@RozzaysRed
Copy link
Contributor

Any command run from explorer.exe in windows would open cmd with "This is a command line tool. You need to open cmd.exe and run it from there".

This pr allows gh commands to be run from windows explorer.

This fixes issue #1919

@RozzaysRed RozzaysRed changed the title Run commands from explorer.exe [WIP] Run commands from explorer.exe Oct 4, 2020
@RozzaysRed RozzaysRed changed the title [WIP] Run commands from explorer.exe Run commands from explorer.exe Oct 4, 2020
The MousttrapHelpText will only be validated in cobra when running on
windows.
@samcoe
Copy link
Contributor

samcoe commented Oct 11, 2020

@RozzaysRed As a non-windows user I am curious what is the use case for being able to run gh from explorer.exe and how do you provide arguments to gh from the explorer window? Also, do we have confirmation that running gh from explorer.exe works properly? It would be great to see a video/gif of this in action if possible.

Copy link
Contributor

@mislav mislav left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me! But like @samcoe I would like to know if it's really worth to enable invoking gh from Explorer, since I can't imagine many use-cases. Also, is there a way to specifically detect when gh was run from Explorer, but still show a MousetrapHelpText when someone double-clicked on gh.exe to run it outside of a terminal?

)

func NewCmdRoot(f *cmdutil.Factory, version, buildDate string) *cobra.Command {
cobra.MousetrapHelpText = ""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is modifying global cobra package state, I would advise moving it to cmd/gh/main.go instead of executing it as part of this function.

@rystaf
Copy link

rystaf commented Oct 13, 2020

The use case is described in #1919
If you want to keep that message for double clicks of the exe, maybe it could check if gh was called without any arguments before blanking out MousetrapHelpText

@mislav
Copy link
Contributor

mislav commented Oct 16, 2020

@rystaf That's an excellent suggestion. 👍

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

Successfully merging this pull request may close these issues.

7 participants