about summary refs log tree commit diff stats
path: root/radish.fnl
diff options
context:
space:
mode:
Diffstat (limited to 'radish.fnl')
-rw-r--r--radish.fnl66
1 files changed, 66 insertions, 0 deletions
diff --git a/radish.fnl b/radish.fnl new file mode 100644 index 0000000..4ce6e22 --- /dev/null +++ b/radish.fnl
@@ -0,0 +1,66 @@
1;;; RADISH
2;; A tuner for various streams
3;; Copyright (C) 2022 Case Duckworth <acdw@acdw.net>
4;; License: Good Choices (https://acdw.casa/gcl)
5
6;;; Entry point
7
8(fn usage []
9 (printn* "RADISH: a tuner for various streams"
10 "Copyright (C) 2022 Case Duckworth <acdw@acdw.net>"
11 "License: Good Choices (https://acdw.casa/gcl)"
12 ""
13 "Commands"
14 " radish [STATION]"
15 " Begin playing STATION. If STATION is not"
16 " provided, display a list of favorites and"
17 " allow the user to choose one to play."
18 " radish play [STATION]"
19 " Begin playing STATION. If STATION is not"
20 " provided, play the most recently-played."
21 " radish kill"
22 " Kill the currently-playing station."
23 " radish add [STATION]"
24 " Add STATION or the currently-playing one"
25 " to the favorites list."
26 " radish del [STATION]"
27 " Remove STATION or the currently-playing"
28 " one from the favorites list."
29 " radish edit [STATION]"
30 " Edit the information of STATION, or the"
31 " current one if not given."
32 ""
33 "See radish(1) for more details."))
34
35(fn main [args]
36 (match args
37 [:play ?station] (radish-play ?station)
38 [:kill] (radish-kill)
39 [:add ?station] (radish-add ?station)
40 [:del ?station] (radish-del ?station)
41 [:edit ?station] (radish-edit ?station)
42 [station] (radish-play station)
43 _ (usage)))
44
45;;; Utilities
46
47(lambda printn* [?sep ...]
48 "Print arguments as strings, delimited by ?SEP.
49?SEP defaults to '\n', but can be anything."
50 (print (table.concat [...] (or ?sep "\n"))))
51
52;;; Functionality
53
54(lambda radish-play [?station])
55
56(lambda radish-kill [])
57
58(lambda radish-add [?station])
59
60(lambda radish-del [?station])
61
62(lambda radish-edit [?station])
63
64;;; End
65
66(main args)