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

external script support for commands #281

Open
justinabrahms opened this issue Oct 9, 2023 · 3 comments
Open

external script support for commands #281

justinabrahms opened this issue Oct 9, 2023 · 3 comments
Labels
enhancement New feature or request

Comments

@justinabrahms
Copy link

Is your feature request related to a problem? Please describe.

I'd like syntax highlighting for bash scripts and similar, which I don't get in TOML.

Also, I'd like it if the scripts were invokable by people who don't want to use nix, provided they have a properly configured environment.

Describe the solution you'd like

instead of command = '''...''', I'd like commandFile = './scripts/foo.sh'

Describe alternatives you've considered

perhaps some toml import synatx something or other, but that seems too complex.

Additional context

@justinabrahms justinabrahms added the enhancement New feature or request label Oct 9, 2023
@deemp
Copy link
Contributor

deemp commented Jan 13, 2024

IDK what's you use case. Please, describe it in more details.

Currently, you can create a script file:

cat > hello.sh <<EOF
printf "hello!\n"
EOF
chmod +x hello.sh

Then, in devshell.toml (this repo uses this file for the default devshell), create a command that runs that file:

# ...
[devshell]
# ...
[[commands]]
help = "prints hello"
name = "hello"
command = "$PRJ_ROOT/hello.sh"
# ...

Now, you can run

$ hello
hello!

@justinabrahms
Copy link
Author

I think that will work for me.

I'm not sure what else to say about the use cases.

  1. I want syntax highlighting so I can see errors.
  2. Some people on my team don't want to use nix. They should be able to invoke the scripts too.

@zimbatm
Copy link
Member

zimbatm commented Jan 14, 2024

In that case, the best thing is to put the scripts in a ./bin or ./scripts folder in your project. Then only use Nix and devshell to bring the dependencies (eg: curl, jq, ...) as @deemp described.

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

3 participants