update genbinding doc
Signed-off-by: Ava Hahn <ava@sunnypup.io>
This commit is contained in:
parent
293eef7d8e
commit
8ba80979f8
1 changed files with 17 additions and 2 deletions
|
|
@ -27,8 +27,23 @@
|
||||||
|
|
||||||
The point is to be able to autogenerate bindings for shell commands.
|
The point is to be able to autogenerate bindings for shell commands.
|
||||||
Example: (eval ((gen-binding (q ls) '-l') ('-a')))
|
Example: (eval ((gen-binding (q ls) '-l') ('-a')))
|
||||||
Or: (def gcommit 'shortcut for git commit -s -m <arg>
|
Or: (def gcommit 'use: (gcommit my-message)'
|
||||||
(lambda (arg) (eval ((gen-binding (q git) 'commit') ('-s' '-m' arg)))))"
|
(lambda (arg) (eval ((gen-binding 'git' 'commit') ('-s' '-m' arg)))))
|
||||||
|
|
||||||
|
|
||||||
|
Or, a more advanced use:
|
||||||
|
(def -git-opts 'all subcommands for guix'
|
||||||
|
('add' 'push' 'stash'))
|
||||||
|
|
||||||
|
;; define global functions for each subcommand
|
||||||
|
(let ((gx-iter (pop -git-opts)))
|
||||||
|
(while (gt? (len gx-iter) 1)
|
||||||
|
(let ((subc (car gx-iter))
|
||||||
|
(rest (cdr gx-iter)))
|
||||||
|
(def (concat 'g-' subc)
|
||||||
|
'subcommand binding for git. takes a list of args'
|
||||||
|
(lambda (args) (eval ((gen-binding 'git' subc) args))))
|
||||||
|
(set (q gx-iter) (pop rest)))))"
|
||||||
(sym subcommand)
|
(sym subcommand)
|
||||||
(let ((lam ((q lambda)
|
(let ((lam ((q lambda)
|
||||||
(cons (q args))
|
(cons (q args))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue