You can use the QOwnNotes command-line snippet manager to execute command snippets stored in notes in QOwnNotes from the command line.
You can use notes with a special tag (commands by default) to store command snippets, which you can
execute from the command-line snippet manager.
For more information on how to add commands and configuration please see Command-line Snippet Manager.
The QOwnNotes command-line snippet manager is based on the wonderful pet CLI Snippet Manager.
Visit the latest release page and download the version you need.
If you have jq installed you can also use this snippet
to download and install for example the latest Linux AMD64 binary to /usr/local/bin/qc:
curl https://api.github.com/repos/qownnotes/qc/releases/latest | \
jq '.assets[] | select(.browser_download_url | endswith("_linux_amd64.tar.gz")) | .browser_download_url' | \
xargs curl -Lo /tmp/qc.tar.gz && \
tar xfz /tmp/qc.tar.gz -C /tmp && \
rm /tmp/qc.tar.gz && \
sudo mv /tmp/qc /usr/local/bin/qc && \
/usr/local/bin/qc versionYou can use homebrew on macOS to install qc.
brew install qownnotes/qc/qcIf you receive an error (Error: qownnotes/qc/qc 64 already installed) during brew upgrade,
try the following command:
brew unlink qc && brew uninstall qc
rm -rf /usr/local/Cellar/qc/64
brew install qownnotes/qc/qcfzf (fuzzy search) or peco (older, but more likely to be installed by default) need to be installed to search for commands on the command-line.
By default fzf is used for searching, but you can use peco by setting it with qc configure.
On some system you might need to set fzf --ansi when you use the qc --color flag.
If you don't want the fuzzy search of fzf, you can use the fzf --exact flag.
Usage:
qc [command]
Available Commands:
completion generate the autocompletion script for the specified shell
configure Edit config file
exec Run the selected commands
help Help about any command
search Search snippets
version Print the version number
Flags:
--config string config file (default is $HOME/.config/qc/config.toml)
--debug debug mode
-h, --help help for qc
Use "qc [command] --help" for more information about a command.
Run qc configure.
[General]
editor = "vim" # your favorite text editor
column = 40 # column size for list command
selectcmd = "fzf" # selector command for edit command (fzf or peco)
sortby = "" # specify how snippets get sorted (recency (default), -recency, description, -description, command, -command, output, -output)
[QOwnNotes]
token = "SECRET" # your QOwnNotes API token
websocket_port = 22222 # websocket port in QOwnNotesYou can generate shell completion code for your shell with qc completion <shell>.
For example for the Fish shell you can use:
qc completion fish > ~/.config/fish/completions/qc.fishExecuted commands can be stored in Atuin on execution
when using the --atuin flag. They will then show up in the Atuin command history.
qc exec --atuin
