When installed, clk comes with an executable that may be used for all your workflows.
But you may want to run your own project without prefixing stuffs with clk....
But first, two things:
- we assume you want to create a tool that contains subcommands, like git, not a single command, like find. This is because we will automatically create some subcommands to deal with aliases, parameters etc.
- we assume you don’t mind creating a full python project and not a single “.py” file.
clk provides out of the box a command to bootstrap your own tool.
clk fork mytool
Now, install mytool with either `pipx install ./mytool` or `python3 -m venv venv && ./venv/bin/pip install ./mytool` followed by `export PATH="$(pwd)/venv/bin/:${PATH}"`. Then, enable its completion with `mytool completion install` and don't forget to have fun
Now, simply install this tool, like suggested.
python3 -m venv venv
./venv/bin/pip install ./mytool
echo "export PATH=$(pwd)/venv/bin/:${PATH}" >> "${TMP}/.envrc" && direnv allow
source "${TMP}/.envrc"
From there, you can play with this new toy.
mytool command create bash hello-world --description "Just say hello" --body 'echo "Hello world"'
mytool hello-world
Hello world
This new tools has all the bells and whistles of clk.
mytool 2>&1
Usage: mytool [OPTIONS] COMMAND [ARGS]...
The current parameters set for this command are: --forced-width --reproducible-output
Options:
--env TEXT Add this custom environment variable
--profiling Enable profiling the application code
-u, --without-extension EXTENSION
Disable this extension for the time of the command
-e, --extension EXTENSION Enable this extension for the time of the command
--report-file TEXT Create a report file to put with bug reports
--reproducible-output Ensure the output is reproducible by redacting the project location (used to have
reproducible tests)
--flow-progress / --no-flow-progress
Show a progress bar when running flow dependencies
--flow-verbose / --no-flow-verbose
Show more precisely when a flow starts and when it ends
--debug-on-command-load-error Trigger a debugger whenever a command fails to load
--post-mortem / --no-post-mortem
Run a post-mortem debugger in case of exception
-D, --develop / --no-develop Same as --log-level develop
-d, --debug / --no-debug Same as --log-level debug
-a, --action / --no-action Same as --log-level action
-q, --quiet / --no-quiet Same as --log-level critical
-L, --log-level [develop|debug|action|status|deprecated|info|warning|error|critical]
Log level (default to 'deprecated')
--ask-secret / --no-ask-secret Interactively ask for the secret if the secret manager does not provide it
--forced-width Force the width of the terminal (used to have reproducible tests)
--alternate-style STYLE Alternate style
--plugin-dirs TEXT
--persist-migration / --no-persist-migration
Make the profile migration persistent, using --no-persist-migration will preserve the
profiles, unless you explicitly write into them. This is useful if you want to use a
razor edge version of the application without forcing peoples to move to it.
-P, --project DIR Project directory
--flow-step / --no-flow-step Make a pause in between the flow steps. Useful to make demonstrations. Implies --flow-
verbose.
--autoflow / --no-autoflow Automatically trigger the --flow option in every command
--no-cache / --cache Deactivate the caching mechanism
--keyring TEXT Use this keyring instead of the default one
-n, --dry-run / --no-dry-run Don't actually run anything
--force-color / --no-force-color
Force the color output, even if the output is not a terminal
--help-all Show the full help message, automatic options included.
--help Show this message and exit.
Commands:
alias Manipulate the command aliases
command Display all the available commands
completion Shell completion
describe Describe the given profile
echo Log a message
exec Run a program, like good old times.
extension Extension related commands
flowdep Manipulate command flow dependencies.
fork Create a brand new project, based on clk that can be used by itself.
hello-world Just say hello
help Display help information
log Log a message
parameter Manipulate command parameters
pip Run pip in the context of this installation of clk
plugin Manipulate plugins
python Run the python executable that is currently running clk
secret Manipulate your secrets
update Upgrade clk
value Manipulate the values