Skip to content

external script support for commands #281

Open

Description

@justinabrahms

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

Activity

  1. deemp commented on Jan 13, 2024

    @deemp
    Contributor

    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!
  2. justinabrahms commented on Jan 14, 2024

    @justinabrahms
    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.
  3. zimbatm commented on Jan 14, 2024

    @zimbatm
    Member

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions