This release is a pre-release and may not be stable for production use.
sdial
Speed dial for the CLI-phile.
Features
- Speed-dial long commands by number
- Multi-line shell snippets/editing via $EDITOR
- No translation: your snippet is your script
- Fast, OS shell-agnostic
- Plain-text, backup-friendly storage
Installation
pip install sdial
After installation, run it as sdial.
Works on Linux, Mac, Windows (cmd.exe!), PowerShell, WSL. If Python runs somewhere, sdial probably does too.
Quick Start
Have a long command that you frequently type and execute?
Add it to sdial!
sdial add 'docker run --rm -it -v $(pwd)/src:/app/src -v ~/.config/myapp:/root/.config/myapp --name myapp_dev_container mycompany/myapp:latest bash'
# Output to stdout: 0
That output means your command can now be dialed with 0:
sdial dial 0
# Executes 'docker run --rm -it -v $(pwd)/src:/app/src -v ~/.config/myapp:/root/.config/myapp --name myapp_dev_container mycompany/myapp:latest bash'
Want to add another multi line, snippet to speed dial?
sdial add
# Opens $EDITOR, just like `git commit`.
# You type or paste your multi line snippet, then save and exit!
Say that you type the following:
while read file
do
# The $1 here allows `sdial` to pass arguments!
if grep -q "$1" "$file"
then
echo "$file"
fi
done
Say after saving, sdial tells you to dial 1 to run this command.
You can then dial and provide an argument for $1:
find . -name '*.py' | sdial dial 1 "TODO"
This allows you to use one pipe to filter all .py files under the current directory containing the string "TODO".
How does that work? sdial just launches:
$SHELL $snippet_file arg1 arg2 ...
That means your speed dial snippet gets executed by $SHELL as a script, with arguments in $1, $2, etc.
It's dead simple: $SHELL semantics, no translation layer. Anything you can do in a $SHELL script (loops, pipes, arguments) just works.
What if you forgot which commands have speed dial numbers, and what each command's number is?
sdial
This prints out something resembling the following CSV:
number,command
0,"docker run --rm -it -v $(pwd)/src:/app/src -v ~/.config/myapp:/root/.config/myapp --name myapp_dev_container mycompany/myapp:latest bash"
1,"while read file\ndo\n # The $1 here allows `sdial` to pass arguments!\n if grep -q \"$1 \"$file\"\n then\n echo \"$file\"\n fi\ndone"
What if you made a mistake when entering a command?
sdial edit 1
This opens $EDITOR and allows you to edit what number 1 speed dials.
What if you want to unregister a command?
sdial remove 1
In this case, if we remove command with number n, then:
- The commands originally with numbers
n + 1,n + 2, ... - Are reassigned the numbers
n,n + 1, ...
FAQ and Tips
Can I use variables, pipes, and advanced shell scripting?
Yes - your snippets are executed as $SHELL $snippet_file $args.... This means:
- All shell scripting works: variables ($1, $2), loops, functions, pipes, etc.
- You can use here docs, pipe to other commands, etc.
How do you store the commands?
- Each command is stored as a file under
~/.sdial/. The filenames are ordered using fractional base58 to allow easy insertion and deletion without renaming every file. - Listing (
sdial) reads their sorted names and shows the commands.
Does this work with cmd.exe or PowerShell?
- Yes! Just beware that cmd.exe and PowerShell have their own syntax and semantics.
Environment variables and context?
- Commands/scripts run with the current environment (
$PWD,$PATH, etc.) as when you invokesdial. - On Unix, use
VARIABLE=value sdial $nto set them.
How do I back up all my dials or share them?
- Simply copy
~/.sdial/- all your scripts are plain text files!
What if I want to reset or wipe all commands?
rm -rf ~/.sdial/
Or selectively delete individual files in there.
Why? Because Nobody Else Had The Guts.
- No one combined numbered launching, fractional indexing, $EDITOR multi-line, and Shell and OS-agnostic design.
- We did.
Contributing
Contributions are welcome! Please submit pull requests or open issues on the GitHub repository.
License
MIT - no nonsense, use it however you want.
Release files for sdial 0.1.0a3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| sdial-0.1.0a3.tar.gz | 5.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| sdial-0.1.0a3-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details |
Total release size: 12.2 kB
Release files / sdial-0.1.0a3.tar.gz
| Download URL | sdial-0.1.0a3.tar.gz |
|---|---|
| Size | 5.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0ac507c4b6ca8eb51b919f8c94ab43ef56978197674319fd93da35a2a751f971
|
|
BLAKE2b-256 checksum How to use checksums |
70dd744fb27ee81e6e6b9bbe5661abce3046b81ebe2ef4c834336f8af81c1e30
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.12
|
Release files / sdial-0.1.0a3-py2.py3-none-any.whl
| Download URL | sdial-0.1.0a3-py2.py3-none-any.whl |
|---|---|
| Size | 6.2 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
4c7b28f719b63a202c6f6df62c2d3f21a6ff7b584a534bec866d718aed7e9a31
|
|
BLAKE2b-256 checksum How to use checksums |
0059a03c0609913e716553a087736bf8ccc2129367db90d90d2ee50b9ea1f6d5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.12
|