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

feat(#100): show CMD for --execute if --show-cmd is added #101

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

AlejandroSuero
Copy link
Contributor

With these changes, if the user adds the flag --show-cmd it will print the executed command when using --execute "<cmd>".

Demo:

show-cmd-flag-demo.mp4

Closes #100

@blacktop
Copy link

blacktop commented Jun 2, 2024

This is perfect! 😍

@AlejandroSuero
Copy link
Contributor Author

I added this locally to better showcase the command:

image

If you think is a good idea and want to add it, making tweaks to colours if needed too.

@almas1992
Copy link

How about defining the --show-cmd flag as a string instead of a boolean? When --show-cmd is passed as an empty string (e.g., --show-cmd=""), it could display the command executed by --execute. If a custom string is provided, that string could be shown instead. This would allow for more flexibility, such as adding icons, custom prompts, or styling.

@AlejandroSuero
Copy link
Contributor Author

Thanks for the feedback @almas1992, I'll try and change it this weekend and see how it turns out.

@AlejandroSuero
Copy link
Contributor Author

@almas1992 This is how it turned out when I change it to a string, the thing is, that if you use it as string, when omitted, it will always show by default, unless we get an option like like --show-cmd="y" to avoid showing it always.

image

The problem with string is that if you use it like freeze -x "eza -la" --show-cmd -c full it will take -c as the string input for --show-cmd.

The other solution would be to have a flag like --show-cmd.title to use it as the title when --show-cmd it's included.

@almas1992
Copy link

@AlejandroSuero The string flag indeed has this issue; it cannot be passed without a value. To resolve this, you can either add a separate .title flag as you suggested, or manually iterate through os.Args to handle the parameters before passing them to kong for parsing.

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.

freeze --execute to include the CMD that is being ran in the output
3 participants