Skip to content

Programmatic filtering #216

Open
Open

Description

@jamiekyle-eb

Idea:

bolt ws --when [ -f ./tsconfig.json ] -- tsc

Activity

  1. lukebatchelor commented on Jan 28, 2019

    @lukebatchelor
    Member

    Would we attempt to parse the test block there, or allow it to run in the shell? Any idea how we could read the return code of that with passing it in as a string 🤔?

  2. jamiekyle-eb commented on Jan 28, 2019

    @jamiekyle-eb
    ContributorAuthor

    I've written a shell script to solve my need here:

    index=0
    split=-1
    
    for arg in "$@"
    do
      if [ "$arg" = '--' ]; then
        split=$index
        break
      fi
      index=$(expr $index + 1)
    done
    
    if [ $split -eq -1 ]; then
      echo "Invalid usage, expected: run-if condition -- command"
      exit 1
    fi
    
    cond=${@:0:$(expr $split + 1)}
    cmd=${@:$(expr $split + 2)}
    
    if eval $cond; then
      exec $cmd
    fi

    Which you can then run as:

    bolt ws exec -- run-if [ -f tsconfig.json ] -- tsc

    Maybe bolt could have something like this built in

  3. jamiekyle-eb commented on Jan 29, 2019

    @jamiekyle-eb
    ContributorAuthor

    Never mind, the above script shits itself in different places

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions