Skip to content

Commit

Permalink
remove Cobra dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
ayakovlenko committed May 7, 2024
1 parent 6754eae commit a780706
Show file tree
Hide file tree
Showing 6 changed files with 133 additions and 331 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ You can use any valid JS as long as it's ES 5.1.
Under the hood, `wf` relies on [dop251/goja][goja] package which supports only
ES 5.1 yet.

```sh
WF_DIR="$(pwd)/examples" ./run tpl daily
```

```js
// $WF_DIR/templates/daily.js
var date = new Date();
Expand Down
28 changes: 28 additions & 0 deletions examples/templates/daily.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
var date = new Date();

var isoDate = date.toISOString().split("T")[0];

var todo = Item("To do today");

if (date.isSaturday()) {
todo.add(Item("Laundry"));
}

if (date.isMonday() || date.isWednesday() || date.isFriday()) {
todo.add(
Item("Workout", [
Item("Push-ups"),
Item("Squats"),
Item("Plank"),
])
);
}

Item(
isoDate,
date.getDayName(),
[
Item("Menu"),
todo,
]
);
18 changes: 13 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
module wf

go 1.15
go 1.22.3

Check failure on line 3 in go.mod

View workflow job for this annotation

GitHub Actions / Build

usage: go 1.23

Check failure on line 3 in go.mod

View workflow job for this annotation

GitHub Actions / Build

usage: go 1.23

require (
github.com/dlclark/regexp2 v1.4.0 // indirect
github.com/dop251/goja v0.0.0-20210215114437-465e240c17c9
github.com/go-sourcemap/sourcemap v2.1.3+incompatible // indirect
github.com/dop251/goja v0.0.0-20240220182346-e401ed450204
github.com/pkg/errors v0.9.1
github.com/spf13/cobra v1.1.3
github.com/urfave/cli/v2 v2.27.2
)

require (
github.com/cpuguy83/go-md2man/v2 v2.0.4 // indirect
github.com/dlclark/regexp2 v1.11.0 // indirect
github.com/go-sourcemap/sourcemap v2.1.4+incompatible // indirect
github.com/google/pprof v0.0.0-20240507183855-6f11f98ebb1c // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/xrash/smetrics v0.0.0-20240312152122-5f08fbb34913 // indirect
golang.org/x/text v0.15.0 // indirect
)
Loading

0 comments on commit a780706

Please sign in to comment.