/link-cli-tool

link is a minimalist and global utility for creating aliases that surpasses standard Bash alias and symlink mechanisms. It supports files, C/C++ code with automatic compilation, Linux commands, argument passing, and works in any shell (Bash, Zsh, Fish).

Primary LanguageCGNU Lesser General Public License v3.0LGPL-3.0

Link — Universal Alias Utility for Files and Commands

link is a minimalist and global utility for creating aliases that surpasses standard Bash alias and symlink mechanisms. It supports files, C/C++ code with automatic compilation, Linux commands, argument passing, and works in any shell (Bash, Zsh, Fish).


Key Features

  1. Universality

Supports C files, other files, and commands.

Automatically compiles and runs C files with passed arguments.

Creates executable wrappers for commands that support arguments ("$@").

  1. Global Mode

Using --global creates aliases in ~/.local/bin.

Aliases are available in any shell without ./

  1. Alias History

All aliases are stored in ~/.link_aliases in the format:

alias = target_or_command

Easy to view all aliases or transfer them to another machine.

  1. Argument Passing

All aliases automatically support argument passing.

Examples:

up -y
mbl input.txt
notes +10 ~/Documents
  1. Shell Neutrality

Works in Bash, Zsh, Fish, and any POSIX terminals.

No additional shell configuration needed for commands and C files.

  1. Automatic C File Compilation

Aliases for .c files compile them on-the-fly and execute.

Example:

link mbl = main_basic_lexer.c --global
mbl input.txt   # auto-compiles and runs
  1. Support for Commands with Spaces and Paths

Can create aliases for complex commands:

link notes = "nano ~/Documents/notes.txt" --global
notes

Installation

  1. Compile the utility:
gcc link.c -o link
  1. (Optional) Add to PATH to avoid specifying the path:
mkdir -p ~/.local/bin
export PATH="$HOME/.local/bin:$PATH"

Usage

Create global alias for a command:

./link up = "sudo apt update" --global
up -y   # works in any shell

Create global alias for a C file:

./link mbl = main_basic_lexer.c --global
mbl input.txt   # auto-compiles and runs

Create local alias (works only in current directory):

./link notes = "nano ~/Documents/notes.txt"
./notes

Check alias history:

cat ~/.link_aliases
# mbl = main_basic_lexer.c
# up = sudo apt update

Advantages Over Standard Bash Methods

Feature Bash alias Symlink link
Argument support ✅ (Limited)
C files with auto-compile
Global availability ❌ (Per-shell)
Cross-shell support ❌ (Shell-specific)
Alias history
Minimal configuration ❌ (Requires shell config)

Future Plans

Add --remove to delete aliases and clean history.

Add alias listing with link --list.

Integration with automation scripts and Makefiles.


Link makes working with aliases convenient, global, and transparent, combining the capabilities of aliases, symlinks, and wrapper scripts in a single tool.