Thanks to visit codestin.com
Credit goes to github.com

Skip to content

windymelt/allyas

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

allyas

A command aliasing tool using symlinks and S-expression configuration.

image

SYNOPSIS

ally [command]

DESCRIPTION

ally provides command aliasing through symlinks. Commands are defined in an S-expression configuration file and executed when the binary is invoked under different names.

The tool operates in three modes:

  • ally: Display help
  • shim: Create symlinks for all configured aliases
  • alias: Execute configured command (any other name)

CONFIGURATION

Set the ALLY_CONF environment variable to specify the configuration file path.

Configuration uses S-expression syntax:

(config
  (alias "ll" "ls -la")
  (alias "gs" "git status")
  (alias "gc" "git commit"))

ENVIRONMENT

ALLY_CONF : Path to configuration file (required)

ALLY_SHIM_DIR
: Directory for symlink creation (required for automatic symlink creation)

ALLY_VERBOSE : Enable verbose output when set to "true"

SHELL : Shell to use for command execution (default: sh)

USAGE

  1. Create configuration file:

    export ALLY_CONF=/path/to/config.conf
  2. Place executable in your $PATH:

    mv ally ~/bin/ # if you have ~/bin in your $PATH
  3. Create symlinks:

    export ALLY_SHIM_DIR=/path/to/shims
    ally shim
  4. Use aliases:

    ll /etc
    gs
    gc -m "commit message"

EXIT STATUS

0: Success
1: Configuration error or unknown command
127: Command not found

Other exit codes are propagated from executed commands.

EXAMPLES

Configuration with arguments:

(config
  (alias "build" "pnpm run build")
  (alias "docker-ps" "docker ps --format table"))

Execution passes additional arguments:

build         # Executes: pnpm run build
docker-ps -a  # Executes: docker ps --format table '-a'

WORKS WELL WITH DIRENV(1)

It works well with direnv.

Configure .envrc like this:

export ALLY_CONF=$(pwd)/.allyconf
export ALLY_SHIM_DIR=$(pwd)/.aliases
PATH=${PATH}:$ALLY_SHIM_DIR

Then prepare configuration file:

(config
  ...)

Finally set symlink and it works well:

ally shim

BUILDING

Requires Scala Native. Use sbt for all build operations:

sbt compile          # Compile source
sbt test             # Run tests  
sbt nativeLink       # Build executable

About

Directory-specific aliasing tool

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages