docs / get
cwm get
Find a saved command, copy it, show it, or run it. Also searches shell history.
$ cwm get [name|id] [flags] How it works
- With a name,
getcopies the command to the clipboard. With no name it lists commands and asks you to pick one. -xruns the command. With the shell wrapper fromcwm setupit runs in your current shell, and the exit code of the command is passed through.--showprints only the command on stdout. Tables, prompts and errors go to stderr, so it is safe to pipe.- Placeholders written as
%name%or{{name}}are filled in by prompts. Comment lines are ignored. -fturns on fuzzy matching: the letters you type must appear in order, not next to each other.- History search (
-h) reads your shell history file.-areads whatcwm watchrecorded for the current folder.
Flags
- -x, --exec
- Run the command instead of copying it.
- --show
- Print the command without copying it.
- -l, --list
- List commands without asking for a choice.
- -t, --tag <tag>
- Only commands with this tag.
- -f, --fuzzy
- Fuzzy search saved commands or history.
- -h, --hist
- Search shell history.
- -a, --active
- Search commands recorded in the current project folder.
- -c, --copy
- Read from the copy bank database.
- -n, --count <n>
- Limit the number of results. History default is 10.
Examples
List everything
$ cwm get -l Saved Commands
ID Variable Command Tags Description
-----------------------------------------------------------------------------------------------
1 hello echo Hello World util Greets user
2 deploy kubectl rollout restart deploy/%... k8s Restart a deployment
3 gs git status -sb gitShow a command without copying
$ cwm get hello --show echo Hello WorldRun a command
$ cwm get hello -x Description: Greets user
Executing command: echo Hello World
Hello WorldUnknown name
$ cwm get nope --show Error: Command 'nope' not found.Browse shell history
$ cwm get -h System Shell History (6/6)
ID Command
----------------------------------------------------------------------
1 npm install
2 git commit -m "feat: setup GoReleaser"
3 ls
4 git commit -m "fix: database schema"
5 docker compose up -d
6 git status
Copy (ID):Commands recorded in this folder
$ cwm get -a -l Local Project History (3/3)
ID Command
----------------------------------------------------------------------
1 git status
2 git commit -m feat
3 npm run build