GithubHelp home page GithubHelp logo

radj307 / alias Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 0.0 65 KB

Emulates bash aliases on Windows.

License: GNU General Public License v3.0

C++ 85.12% CMake 14.88%
windows bash-aliases command commandline cli configurable commandline-alias

alias's Introduction

alias

A filename-based Windows executable that emulates the specified command in a terminal, similar to bash aliases.

This allows you to create command aliases or command macros on windows, or execute shell scripts (.bat/.ps1) using an executable (.exe).

Features

  • Same return code as executing the command manually
  • Forwards commandline arguments
  • Filename-based configuration allows you to have any number of aliases in the same directory
  • Live-updating output

Usage

  1. Download the latest release.
  2. Rename the executable to whatever you want.
  3. Run the executable once, which will create the default configuration file in the same directory as the executable.
  4. Edit the generated .ini file & set the command to execute.

Example

Say you wanted to create an alias lsf for the PowerShell command Get-ChildItem -Force.

  1. Download (or copy-paste) alias.exe & move it to a directory on your PATH.
  2. Rename alias.exe to lsf.exe, then run it once to generate the config file.
  3. Edit lsf.ini:
    [target]
    command = "PowerShell -Command 'Get-ChildItem -Force'"
    forward_args = true
    Now you can run the lsf command to execute Get-ChildItem -Force

How it Works

When the program is called, it finds its current location and searches that directory for an ini file with the same name.

It then uses the popen function to open a process pipe that it uses to emulate that process.
The executed command's return code is forwarded by the program when it exits as well.

Note: popen uses cmd.exe by default; to execute PowerShell commands you must prepend powershell -Command to the command string in the config.

alias's People

Contributors

radj307 avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.