New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add config option to customize 'No such task' behavior #1219
Comments
Yeah, we could have
and we can add stuff to the input map. The default task then becomes responsible also for |
Btw, would it make sense to make a datascript pod, so that component becomes more re-usable for other bb users/scripts as well? There's already a datalevin pod btw: https://github.com/babashka/pod-registry/blob/master/examples/datalevin.clj |
Maybe we should stick to the non-function approach:
and we can add stuff to |
Sounds great 馃憤 Hopefully I'll get to it this weekend |
That would definitely be nice. I didn't see much documentation on building releases and I don't have much personal time to do this. If I give this a try, what would be the easiest example to copy from? |
@cldwalker Probably buddy (recently updated) or datalevin (since that's close to datascript). |
I'm also looking for something like this. One way I can do that is to read bb.edn files and register tasks dynamically, based on the tasks I find in those files. Simple way of doing this: {:tasks {:requires ([clojure.string :as str])
app {:doc "Without arguments, prints tasks in app - with arguments, invokes task in app dir"
:task (if (empty? *command-line-args*)
(shell {:dir "app"} "bb tasks")
(shell {:dir "app"} (str "bb run " (str/join " " *command-line-args*))))}}} Using a default function I could implement the logic based on the command line parameters. |
Another alternative is to generate the |
I'll think about it and maybe try it out. |
@ieugen That is true, but I expect the churn of subdirectories in a project to not be so high that this becomes annoying. Also there are ways to automate that by e.g. adding the bb.edn re-generation as a task dependency of other common ran tasks or as a git pre-commit hook, or both. I've done that e.g. here in clerk: Installing the git commit hook, happens when invoking a task And the actually pre-commit hook executes a task which refreshes a file (in this case a SHA, but in your case it would be the re-generated bb.edn): https://github.com/nextjournal/clerk/blob/main/dev/pre-commit |
Another thought, what about:
which executes a task in directory app So this would be equivalent to:
Not entirely sure if that's a good idea or not, but currently it was already not possible to use slashes in task names, so it should at least not be breaking. |
And possibly
|
I think both approaches have merit. |
Let's continue the discussion about tasks in monorepos here: #1044 |
Hi @borkdude 馃憢
Is your feature request related to a problem? Please describe.
I'd like to be able to customize the behavior when a task is not found
Describe the solution you'd like
Support a top-level config option that takes the task not found and maybe any args e.g.
:task-not-found (fn [task args] (run 'default-task))
Some use cases I could use this for:
Describe alternatives you've considered
I don't know of a way I can patch the internals since it seems hardcoded
Additional context
Happy to work on this if you agree it'd be helpful
The text was updated successfully, but these errors were encountered: