Skip to content

Support for custom commands #113

@tengstrand

Description

@tengstrand

Is your feature request related to a problem? Please describe.
Add support for custom commands that could be executed by the poly tool.

Describe the solution you'd like
The code for the different custom commands could be added to the poly alias in the root deps.edn file. The commands could be specified in workspace.edn, e.g.:

{
  :commands {"ls" com.mycompany.customcode.ls-command}
...
}

The function will take the internal workspace structure as input, like this:

(defn ls-command [workspace]
  (let [args (-> workspace :user-input :args)
    (apply sh args)))

It would be good also if these commands could support autocomplete, see issue #106.

Additional context
With this in place combined with support for autocomplete, the existing AOT compiled poly command (or a native version of it, see issue #100) would be less attractive to use, because they would not support custom commands and even the native version would be outperformed in terms of startup time by the shell command (which executes instantly).

I think this is the way to go, because then we could use the infrastructure that tools.deps.alpha supports, where code can easily be added and executed as compiled code.

This would also allow people to contribute with new functionality to the poly tool, and it would be good if it could list the available custom commands out there and give som guidance in how to "install" them (how to add them to the :poly alias).

Metadata

Metadata

Assignees

Labels

improvementNot a bug but an improvement to overall user experience

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions