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

New feat req for echoing shell commands #103

Open
ikappaki opened this issue Mar 4, 2023 · 3 comments
Open

New feat req for echoing shell commands #103

ikappaki opened this issue Mar 4, 2023 · 3 comments

Comments

@ikappaki
Copy link
Contributor

ikappaki commented Mar 4, 2023

Hi,

it is considered a useful aid in shell scripting to echo the commands being executed.

This is a request to include such an :echo true option in shell or/and process (defaults to false).

e.g.

(babashka.process/shell {:echo true} "ls" "-al")
;; => /usr/bin/ls -al
...

This should work well with the babashka.process/*defaults* for echoing all commands in a block, e.g.

(binding [p/*defaults* (assoc p/*defaults* :echo true)]
  (p/shell "ls" "-al"))

would it be also possible to expose babashka.tasks/*defaults* in babashka please, it seems to be missing (babashka.process/*defaults* though is working fine).

Another idea discussed in slack is whether it will also be a good idea to include convenience fn such as

(babashka.process/set-default :echo true)

Thanks

@borkdude
Copy link
Contributor

borkdude commented Mar 4, 2023

Yes to both.

Also:

(babashka.process/shell {:echo true} "ls" "-al)
;; => /usr/bin/ls -al

Should we print ls as the user has written it, or the resolved program, like process finds it?

@ikappaki
Copy link
Contributor Author

ikappaki commented Mar 4, 2023

Perhaps we could support both? I find the full path command useful but it could be too much for some users. Would it be a good idea to have :echo false :echo true :echo :verbose as options?

@ikappaki
Copy link
Contributor Author

ikappaki commented Mar 4, 2023

(:verbose/full/resolve whatever word is most appropriate)

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