Fork me on GitHub
#babashka
<
2023-05-16
>
pez08:05:50

I’m doing something wrong trying to set a default value for a command line option:

(cli/parse-opts ["-a" "foo" "-alias" "bar"] {:alias {:a :alias}
                                               :default {:alias [:dev]}
                                               :coerce {:alias [:keyword]}})
  ;; => {:alias [:foo :bar]}

  (cli/parse-opts [] {:alias {:a :alias}
                      :default {:alias [:dev]}
                      :coerce {:alias [:keyword]}})
  ;; => {}
The first one is fine, but I want the second one to give me {:alias [:dev]}. I shall not bore you with all the ways I have tried. 😃 Anyone knows how this should be done?

borkdude08:05:21

user=> (cli/parse-opts [] {:spec {:a {:default 1}}})
{:a 1}

borkdude08:05:58

I think :default is only supported in the :spec notation

pez08:05:31

Thanks!

(cli/parse-opts [] {:spec {:alias {:alias :a
                                     :default [:dev]
                                     :coerce [:keyword]}}})
  ;; => {:alias [:dev]}
(I tried things quite similar to that. But missed the significance of the :spec entry.)

pesterhazy19:05:57

Introducing beep-boop, the test wrapper with sound and colors https://github.com/pesterhazy/beep-boop

🎹 11
🎉 3
🔊 5
pesterhazy19:05:09

36 lines of babashka 🙂

pesterhazy19:05:23

In case you can't tell, I really enjoy hearing a pleasant chime when tests pass (or a melancholy chord if they fail)

👍 1
teodorlu21:05:41

Is this mac only? I can't find an afplay binary or a /sounds folder on my linux system 🙂

pesterhazy22:05:21

@U3X7174KS try the latest master – does this work for you? You'll need one of afplay, aplay or play installed https://github.com/pesterhazy/beep-boop/commit/60fdb558781c1162c4ee0a935b14334fc0778ebe

👀 2
pesterhazy22:05:52

The .wav files are bundled

👍 2
cldwalker01:05:00

@U06F82LES Cool and fun idea! I ported the sounds I enjoyed from boot at https://github.com/logseq-cldwalker/beep-boop . I also turned off the start sound since I don't have much use for it. If you'd like to make the type of sound and start configurable somehow, happy to contribute that back

pesterhazy15:06:31

Nice @U08ALHZ2N. It would be a good addition to beep-boop to make the sounds configurable