You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You can define your own functions and load them by using `--file` option or `--stdin` option.
72
119
73
-
$ gitwerk semver minor
74
-
v0.1.0
75
-
76
-
$ gitwerk semver major
77
-
v1.0.0
120
+
```bash
121
+
gitwerk --stdin myfunc
122
+
(defn myfunc []
123
+
(print "this is my first func"))
78
124
```
79
125
80
-
### sci
126
+
Available functions are non-side-effecting functions enabled in [sci](https://github.com/borkdude/sci) and the exported functions in gitwerk.internal and gitwerk.prelude namespaces.
81
127
82
-
gitwerk supports to run user-defined scripts written in clojure (powered by [borkdude/sci](https://github.com/borkdude/sci)).
83
-
84
-
```bash
85
-
## can read stdin
86
-
$ echo'(semver ctx ["patch"])'| gitwerk sci
87
-
v0.0.2
88
-
89
-
## also read a file as a script
90
-
$ cat examples/example1.clj
91
-
(semver ctx ["patch"])
92
-
$ gitwerk sci examples/example1.clj
93
-
v0.0.3
94
-
95
-
## fetch executed command result and modify returned message
96
-
$ cat examples/example2.clj
97
-
(let [res (semver-auto ctx nil)
98
-
status (get-in res [:console-out :status])
99
-
oldv (get-in res [:console-out :old-version])
100
-
newv (get-in res [:console-out :new-version])]
101
-
(if (= status :updated)
102
-
(str "Version updated: " oldv " -> " newv)
103
-
"Version not updated"))
104
-
$ gitwerk sci examples/example2.clj
105
-
Version not updated
106
-
107
-
$ git commit --allow-empty -m "[patch] version updated"
0 commit comments