Skip to content

A command line alias manager and note taking tool

License

Notifications You must be signed in to change notification settings

MatteoNardi/again

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Again - Alias manager

Again is a simple alias manager for shell commands. It can also be used as a note taking tool for commands you don't want to forget.

asciicast

Motivation

I wrote this because I often find useful commands I want to remembar, but since I don't don't have a daily use for them, I keep forgetting. I do search my bash history with Ctrl-R, but sometimes I don't remembar what to look for, sometimes I don't use a command for so long it gets deleted.

  • DO use it for long commands you don't want to commit to a git repository.
  • DO NOT use it for long commands that could be useful to others. Write a script instead.
  • DO NOT use it for aliases you'll want to use forever. Write a proper alias in your ~/.bashrc instead.
  • DO use it as a note taking tool for commands you rarely use but don't want to forget.

Installation

Installation requires Rust and cargo:

# cargo install --git https://github.com/MatteoNardi/again

You may want to alias it to a shorter name:

# echo alias ag=again >> ~/.bashrc
# source ~/.bashrc

You can enable autocompletions with:

# cargo run -- completions bash > ~/.config/bash_completion

If you aliased it to something else, use:

# cargo run -- completions bash --exe ag > ~/.config/bash_completion

Usage

# again --help
again 0.1.0
Matteo Nardi <[email protected]>
A commands alias manager

USAGE:
    again <SUBCOMMAND>

OPTIONS:
    -h, --help       Print help information
    -V, --version    Print version information

SUBCOMMANDS:
    completions    Generate again shell completions for your shell to stdout
    delete         Delete an alias
    edit           Edit a command in your editor
    help           Print this message or the help of the given subcommand(s)
    list           List aliases
    rename         Rename an alias
    run            Run an alias
    save           Save an alias

# again save hello echo hello world

# again ls
hello: echo hello world

# again run hello
hello: echo hello world
hello world

# cat ~/.config/ag_registry/ag_registry.toml
hello = 'echo hello world'

# again delete hello
Deleted hello:
"echo hello world"

Tips & tricks

This program works great with bash history substitution. The most important thing to know is that !! gets replaced with the last typed command (See man history for more details)

# echo some long and complicated program
some long and complicated program

# ag save complicated !!
ag save complicated echo some long and complicated program
complicated:
  echo some long and complicated program

# ag run complicated
complicated: echo some long and complicated program
some long and complicated program

Thanks

A special thanks to my employer Exein for being awesome and granting us weekly half-day slots for OSS work on personal projects.

About

A command line alias manager and note taking tool

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages