Skip to content

Commit

Permalink
add example, fix wrong validation
Browse files Browse the repository at this point in the history
  • Loading branch information
heinthanth committed May 15, 2022
1 parent be7df10 commit 39b2a8a
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 3 deletions.
43 changes: 42 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,48 @@ Just a make-like task runner but with more power! It's written in CoffeeScript +
## Downloads

Go to Release page and download builds!
And move it to your path. Eg. `/usr/bin`, `/usr/local/bin`, etc. For windows, the same :P.
And move it to ur path. Eg. `/usr/bin`, `/usr/local/bin`, etc. For windows, the same :P.

## Configurations

Complete Configurations Example:

```yaml
dependOnMeToo:
description: another task
# cwd: /some/path/too
command:
- cmd: echo "I can read {{ opt.release }} if 'dependOnMe' task call me"
when: opt.release # if opt.release is true
- cmd: echo "Since passParentOptions is true in 'dependOnMe' task"
when: opt.release # if opt.release is true
passEnv: [ PATH ] # u need to pass env to use ur PATH.
dependOnMe:
description: some task
# cwd: / # try change cwd and see {{ Deno.cwd() }} output!
shell: bash # default shell
dependencies:
- name: dependOnMeToo
passParentOptions: true
command:
- cmd: echo "I can read {{ opt.FOO }}"
shell: zsh # u can use another shell rather than default one
- cmd: echo "Don't run me unless status is 'true'"
when: opt.status == 'true'
- echo "I'm a command too. In {{ Deno.cwd() }}" # deno expressions are supported
taskName:
description: a description
dependencies:
- name: dependOnMe
options:
FOO: bar
status: "{{ opt.status == 1 }}"
release: "{{ opt.release }}" # u can use --release CLI option if passCLI is true
passCLI: true
command: echo "this is main task"
```
I think this example show u a lot! Have Fun xuerunning!
## How to Build
Expand Down
32 changes: 32 additions & 0 deletions example.xuerun
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
dependOnMeToo:
description: another task
# cwd: /some/path/too
command:
- cmd: echo "I can read {{ opt.release }} if 'dependOnMe' task call me"
when: opt.release # if opt.release is true
- cmd: echo "Since passParentOptions is true in 'dependOnMe' task"
when: opt.release # if opt.release is true
passEnv: [ PATH ] # u need to pass env to use ur PATH.
dependOnMe:
description: some task
# cwd: / # try change cwd and see {{ Deno.cwd() }} output!
shell: bash # default shell
dependencies:
- name: dependOnMeToo
passParentOptions: true
command:
- cmd: echo "I can read {{ opt.FOO }}"
shell: zsh # u can use another shell rather than default one
- cmd: echo "Don't run me unless status is 'true'"
when: opt.status == 'true'
- echo "I'm a command too. In {{ Deno.cwd() }}" # deno expressions are supported
taskName:
description: a description
dependencies:
- name: dependOnMe
options:
FOO: bar
status: "{{ opt.status == 1 }}"
release: "{{ opt.release }}" # u can use --release CLI option if passCLI is true
passCLI: true
command: echo "this is main task"
8 changes: 6 additions & 2 deletions src/schema.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@ import { create, defaulted, optional, union, object, record,
array, string, number, boolean, validate } from "https://esm.sh/superstruct";

# use eval?
XueRunUserCmd = union([string(), object({ shell: optional(string()), cmd: string(),
'when': defaulted(union([string(), number(), boolean()]), () => 'true') })]);
XueRunUserCmd = union([
string(),
object({
shell: optional(string()),
cmd: string(),
'when': defaulted(optional(union([string(), number(), boolean()])), () => 'true') }) ]);

XueRunIngredient$option = union([string(), number(), boolean()])
export XueRunIngredient = object
Expand Down

0 comments on commit 39b2a8a

Please sign in to comment.