diff options
Diffstat (limited to 'radish.fnl')
-rw-r--r-- | radish.fnl | 89 |
1 files changed, 35 insertions, 54 deletions
diff --git a/radish.fnl b/radish.fnl index 4ce6e22..acba83f 100644 --- a/radish.fnl +++ b/radish.fnl | |||
@@ -3,64 +3,45 @@ | |||
3 | ;; Copyright (C) 2022 Case Duckworth <acdw@acdw.net> | 3 | ;; Copyright (C) 2022 Case Duckworth <acdw@acdw.net> |
4 | ;; License: Good Choices (https://acdw.casa/gcl) | 4 | ;; License: Good Choices (https://acdw.casa/gcl) |
5 | 5 | ||
6 | ;;; Entry point | 6 | (local util (require :util)) |
7 | (local pls (require :pls)) | ||
8 | (local radish (require :lib)) | ||
7 | 9 | ||
8 | (fn usage [] | 10 | (fn usage [] |
9 | (printn* "RADISH: a tuner for various streams" | 11 | (util.printlns "RADISH: a tuner for various streams" |
10 | "Copyright (C) 2022 Case Duckworth <acdw@acdw.net>" | 12 | "Copyright (C) 2022 Case Duckworth <acdw@acdw.net>" |
11 | "License: Good Choices (https://acdw.casa/gcl)" | 13 | "License: Good Choices (https://acdw.casa/gcl)" |
12 | "" | 14 | "" |
13 | "Commands" | 15 | "Commands" |
14 | " radish [STATION]" | 16 | " radish [STATION]" |
15 | " Begin playing STATION. If STATION is not" | 17 | " Begin playing STATION. If STATION is not" |
16 | " provided, display a list of favorites and" | 18 | " provided, display a list of favorites and" |
17 | " allow the user to choose one to play." | 19 | " allow the user to choose one to play." |
18 | " radish play [STATION]" | 20 | " radish play [STATION]" |
19 | " Begin playing STATION. If STATION is not" | 21 | " Begin playing STATION. If STATION is not" |
20 | " provided, play the most recently-played." | 22 | " provided, play the most recently-played." |
21 | " radish kill" | 23 | " radish kill" |
22 | " Kill the currently-playing station." | 24 | " Kill the currently-playing station." |
23 | " radish add [STATION]" | 25 | " radish add [STATION]" |
24 | " Add STATION or the currently-playing one" | 26 | " Add STATION or the currently-playing one" |
25 | " to the favorites list." | 27 | " to the favorites list." |
26 | " radish del [STATION]" | 28 | " radish del [STATION]" |
27 | " Remove STATION or the currently-playing" | 29 | " Remove STATION or the currently-playing" |
28 | " one from the favorites list." | 30 | " one from the favorites list." |
29 | " radish edit [STATION]" | 31 | " radish edit [STATION]" |
30 | " Edit the information of STATION, or the" | 32 | " Edit the information of STATION, or the" |
31 | " current one if not given." | 33 | " current one if not given." |
32 | "" | 34 | "" |
33 | "See radish(1) for more details.")) | 35 | "See radish(1) for more details.")) |
34 | 36 | ||
35 | (fn main [args] | 37 | (fn main [args] |
36 | (match args | 38 | (match args |
37 | [:play ?station] (radish-play ?station) | 39 | [:play ?station] (radish.play ?station) |
38 | [:kill] (radish-kill) | 40 | [:kill] (radish.kill) |
39 | [:add ?station] (radish-add ?station) | 41 | [:add ?station] (radish.add ?station) |
40 | [:del ?station] (radish-del ?station) | 42 | [:del ?station] (radish.del ?station) |
41 | [:edit ?station] (radish-edit ?station) | 43 | [:edit ?station] (radish.edit ?station) |
42 | [station] (radish-play station) | 44 | [station] (radish.play station) |
43 | _ (usage))) | 45 | _ (usage))) |
44 | 46 | ||
45 | ;;; Utilities | 47 | (main arg) |
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) | ||