tooploox / oya

Using Oya packs containing reusable boilerplate & scripts, you can bootstrap easy to work with, deployable projects
https://oya.sh
MIT License
151 stars 3 forks source link

Feature Request: Task descriptions #62

Closed reggi closed 5 years ago

reggi commented 5 years ago

I'd love to see descriptions in the oya tasks command of what a task is.

Project: Example

descriptions: 
  meow: 'Say Meow'

meow: | 
    echo 'meow'

Then:

➜  oya-test oya tasks
oya run meow .......................... Say Meow    

It would be nice to have descriptions and arguments.

reggi commented 5 years ago

Here's an alternative idea, if a command is an object allow specific properties:

company.build-prod:
  description: Build production
  command: |
    docker-compose exec api yarn run tsc --pretty --project tsconfig.production.json

company.single-test: 
  description: Run a single test
  args: 
    file: 
      type: FILE
  command: |
    docker-compose exec api yarn test-pattern ${file}
bilus commented 5 years ago

@reggi Thanks for the suggestions!

As far as descriptions, it's already implemented (just not documented yet, sorry) using task meta-information syntax (<task-name>.<meta-key>):

Project: aaa

build.Doc: Builds the system
build: |
  ./build
$ oya tasks
# in ./Oyafile
oya run anotherTask
oya run build        # Builds the system

In general, we have ideas for more of these extensions (including declarative argument checking and task dependencies).

As far as arguments, while there's no way to validate them (yet), there are ways you can access them beyond what bash supports ($@, $1, etc.):

Project: foo

build.Doc: Builds the system
build: |
  echo build ${Oya[Args.0]} ${Oya[Flags.all]} ${Oya[Flags.target]}
$ oya run build file.txt --all --target=ababa
build file.txt true ababa

Notice the ${Oya[xxx]} syntax. Oya uses associative arrays in bash scripts to make it both compatible with regular bash 4 scripts & to avoid conflicts with existing env variables.

bilus commented 5 years ago

We need to document this. Created #67 to address it. I'm closing this issue but if anybody feels it should be reopen, please feel free to do so.