Create ad-hoc commands to be dispatched in their own namespace.
ahd; Ad-Hoc Dispatcher
Create ad-hoc commands to be dispatched within their own namespace.
pip install ahd or
sudo pip3 install ahd
- Clone this repo: (https://github.com/Descent098/ahd)
pip install .or
sudo pip3 install .in the root directory
Usage: ahd list [-l] ahd [-h] [-v] [-d] ahd docs [-a] [-o] ahd config [-e] [-i CONFIG_FILE_PATH] ahd register <name> [<command>] [<paths>] ahd <name> [<command>] [<paths>] Options: -h, --help show this help message and exit -v, --version show program's version number and exit -l, --long Shows all commands in configuration with paths and commands -a, --api shows the local API docs -o, --offline shows the local User docs instead of live ones -e, --export exports the configuration file -i CONFIG_FILE_PATH, --import CONFIG_FILE_PATH imports the configuration file
Here is a quick example of creating a command that runs
sudo apt-get update && sudo apt-get upgrade:
- Register the command as the name "update":
ahd register update "sudo apt-get update && sudo apt-get upgrade"
- Run the command using the name "update":
This example was somewhat trivial but keep in mind this effectively means you can replace any short bash scripts you are using to do things like updating multiple git repos, executing a sequence of commands to sort your downloads folder etc.
The list command shows a list of your current registered commands.
- --long: Shows all commands in configuration with paths and commands
The docs command is designed to bring up documentation as needed, you can run
ahd docs to open the documentation site in the default browser.
-a --api: Used to serve local API documentation (Not yet implemented)
-o --offline: Used to serve local user documentation (Not yet implemented)
This command is used for all configuration management. Due to the amount of preprocessing involved in keeping ahd cross platform the dotfile is obstructed from view by default. The config command is the main interface for managing configurations manually though I would recommend using the register command as opposed to this, or looking at the documentation for details about manual configuration.
-e --export: Export the current configuration file (it's a dotfile so make sure view hidden files is enabled)
-i --import: Import a configuration file; takes the path as an argument
The register command allows you to register a name to be used later on. For example if I wanted to create a command that dispatched running git pull in several of my directories that is activated when I type
ahd git-upt then I can just run
ahd register git-upt "git pull" "~/path/to/project, ~/path/to/project-2, ~/path/to/project-3
This is a placeholder value for the name of a command you have registered. Once the command is registered you can run it by using
ahd <name>, additionally you can override the default set commands or paths, details can be found at https://ahd.readthedocs.io/en/latest/usage#overriding.
V 0.4.0; February 10th
Focus for this release was breaking up command line parsing into more testable chunks.
- All argument parsing is now based on discrete functions
- Added a list command to show your current available commands
- Created API documentation site: https://kieranwood.ca/ahd
V 0.3.0; February 6th
Focus for this release was on building sustainable development pipelines (logging, testing etc.), and making the project more reliable in edge cases and error handling.
- Built out the testing suite to be run before release
- Built out the logging mechanism for debugging
- Introduced many error catches for various issues.
- Added config command to bash autocomplete
V 0.2.1; February 2nd 2020
- Added support for . as current directory path
- Fixed issue with being unable to import configuration files
- Fixed issue with docs command when running --api
V 0.2.0; February 2nd 20202
Focus was on improving the overall useability of ahd. Note this version breaks backwards compatibility, but includes a migration guide in the docs (to be removed in V0.3.0).
- Bash Autocomplete implemented (ZSH and fish to come)
- Ability to export configuration
- Ability to import configuration
- Added a top level "docs" command to easy access documentation
- Added cross-platform wildcard support (see docs for usage)
- Added cross-platform home directory (see docs for details)
- Fixed issue where running "register" command without any flags would error out instead of printing help info
- Fixed issue with relative path tracking
- Added issue templates for bug reports and feature requests
- Added pull request templates
- Added contribution guide
- Added migration information
- Added relevant documentation for all features released in V0.2.0
V 0.1.0; January 28th 2020
Initial release focused on creating the basic functionality for the ahd command.
- Ability to register a command
- Ability to specify command to run
- Ability to specify the location(s) to run the command in.
- Have commands store to a configuration file using configparser
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size ahd-0.4.0-py2.py3-none-any.whl (22.8 kB)||File type Wheel||Python version py2.py3||Upload date||Hashes View hashes|
|Filename, size ahd-0.4.0.tar.gz (12.4 kB)||File type Source||Python version None||Upload date||Hashes View hashes|