{"id":15641074,"url":"https://github.com/unforswearing/aliaser","last_synced_at":"2025-04-30T09:06:13.344Z","repository":{"id":30842375,"uuid":"34399838","full_name":"unforswearing/aliaser","owner":"unforswearing","description":"An alias management / directory traversal tool for the command line","archived":false,"fork":false,"pushed_at":"2023-05-22T17:25:40.000Z","size":813,"stargazers_count":5,"open_issues_count":2,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-10-03T11:41:44.529Z","etag":null,"topics":["aliases","bash","directory-traversal","shell"],"latest_commit_sha":null,"homepage":"","language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/unforswearing.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-04-22T15:49:03.000Z","updated_at":"2024-01-04T00:18:34.000Z","dependencies_parsed_at":"2024-10-03T11:41:20.857Z","dependency_job_id":null,"html_url":"https://github.com/unforswearing/aliaser","commit_stats":{"total_commits":133,"total_committers":4,"mean_commits":33.25,"dds":0.518796992481203,"last_synced_commit":"66908a0d79a3d6b9c3a07af3e2c707ebef63da95"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unforswearing%2Faliaser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unforswearing%2Faliaser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unforswearing%2Faliaser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unforswearing%2Faliaser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/unforswearing","download_url":"https://codeload.github.com/unforswearing/aliaser/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221099258,"owners_count":16755900,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aliases","bash","directory-traversal","shell"],"created_at":"2024-10-03T11:41:17.794Z","updated_at":"2025-04-30T09:06:13.329Z","avatar_url":"https://github.com/unforswearing.png","language":"Lua","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://github.com/unforswearing/aliaser/actions/workflows/shellcheck.yml/badge.svg)](https://github.com/unforswearing/aliaser/actions/workflows/shellcheck.yml)\n\n# aliaser\n\n\u003e `aliaser` is a self-editing alias management tool.\n\n## About\n\nThis tool was created to manage persistent aliases when using `bash` or `zsh` interactively.\n\n`aliaser` consists of a single bash function that stores its own aliases. Each alias crated with `aliaser` is appended to the [bottom of the `aliaser.sh` script itself](aliaser.sh#L178). When you source `aliaser.sh` you add the `aliaser` function, and all of the aliases created with this function, to your environment. Please see [aliaser.sh](aliaser.sh) to see how this works.\n\n\u003e [!IMPORTANT]\n\u003e `aliaser` is written in `bash`, tested interactively in `zsh` on MacOS and passes most `shellcheck` tests. This script has not been tested on any Linux-based systems.\n\n## Installation\n\nClone this repo and source `aliaser/aliaser.sh` to get started.\n\n```console\n$ git clone https://github.com/unforswearing/aliaser.git .\n$ source aliaser.sh\n$ aliaser help\n```\n\nFor persistent use you may source `aliaser` from your `.bashrc`, `.zshrc`, or other shell configuration files. The `aliaser` script must know its own location, so be sure to set up the `ALIASER_SOURCE` environment variable so that it points to `aliaser.sh`.\n\n```bash\n# in your $dotfiles:\nexport ALIASER_SOURCE=\"path/to/aliaser/aliaser.sh\"\nsource \"$ALIASER_SOURCE\"\n```\n\n## Dependencies\n\n`aliaser` will warn you if either or both of these tools are not found in your environment:\n\n- [`fzf`](https://github.com/junegunn/fzf)\n- [`gnu-sed`](https://www.gnu.org/software/sed/) (as `gsed` on MacOS)\n\n## Usage\n\nTyping `aliaser help` prints  help documentation, including the following list of options:\n\n```\nOptions:\n    help      display this help message\n    list      list aliases saved in alias file\n    dir       create an alias with 'name' that will cd to 'path'\n    lastcmd   create an alias from the previous command in your history\n    edit      edit alias file in ${EDITOR}\n    search    search aliases, select and print matches\n    open      open the 'aliaser.sh' script in ${EDITOR}\n    clearall  remove all aliases from this alias file\n```\n\n### Adding aliases\n\nAliases can be added to the `aliaser.sh` script using the folling commands:\n\n#### Create an alias that will navigate to the provided path when executed using 'name'.\n\n```\naliaser dir \u003cname\u003e \u003cpath\u003e\n```\n\n#### Create an alias from the last command in your shell history.\n\n```\naliaser lastcmd \u003cname\u003e\n```\n\n#### Create an alias without an option flag\n\nRunning `aliaser` without an option flag will allow you to save aliases to this script in a slightly more traditional manner:\n\n```\naliaser \u003cname='command'\u003e\n```\n\nDouble quote the entire argument to ensure your aliases are not mangled by the script.\n\n```console\naliaser \"cd_home_ls='cd $HOME \u0026\u0026 ls'\"\n```\n\n### Listing and searching for aliases\n\nUse `aliaser list` to print a list of the aliases currently stored in the script.\n\nThe `aliaser search \u003cquery\u003e` command will allow you to search your aliases for items matchin `query`. `aliaser` will print the result of the search, or a warning if no match was found. If there is more than one search result, `aliaser` will use `fzf` to let you select between the available matches.\n\n### Editing and removing aliases\n\nThe `aliaser edit` command can be used to add new aliases manually, or remove aliases from your list. This is especially useful if you would like to enter multiple aliases at once.\n\n`aliaser` does not have a builtin command to remove individual aliases from the list. Please use `aliaser edit` to modify individual entries. You may use `aliaser clearall` to remove all aliases from the list.\n\n### Debugging and modifications\n\nIf you find that an alias has been accidentally mangled, use the `aliaser edit` command to modify any alias stored in the script. You may also use `aliaser open` to modify the `aliaser.sh` script directly, debug your aliases, or improve the code.\n\n## Examples\n\n`aliaser` has some example aliases stored at the bottom of the script to show how `aliaser` stores aliases. Run `aliaser clearall` to remove these examples before adding your own aliases.\n\n### Create an alias from the current dir\n\n```console\n$ aliaser dir \"project_dir\" \"$HOME/projects\"\n\nAdded: alias 'project_dir':\n  \u003e cd \"/Users/unforswearing/projects\"\n```\n\n### Create an alias from the last command in your history\n\n```console\n$ sleep 2 \u0026\u0026 echo awake\n\nawake\n\n$ aliaser lastcmd \"wakeup\"\n\nAdded: alias 'wakeup':\n  \u003e \"sleep 2 \u0026\u0026 echo awake\"\n```\n\n## To Do / Roadmap\n\nSee [TODO.md](TODO.md)\n\n\n\u003c!--\n### Search for an alias and use the matching command in a script\n\nIn your terminal:\n\n```console\n$ shfmt -i 2\n$ aliaser lastcmd \"format\"\n```\n\nUse the `format` alias in a script:\n\n```bash\n# new_script.sh\nsource aliaser.sh\n\n# use 'format'\n\"$EDITOR\" ./build.sh\nbuild_formatted=$(aliaser search \"format\" \"./build.sh\")\n```\n--\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funforswearing%2Faliaser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Funforswearing%2Faliaser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funforswearing%2Faliaser/lists"}