Skip to content
welbornprod edited this page Jan 23, 2013 · 2 revisions

Alias Manager

Description:

Manages BASH alias/function scripts through GUI. Easily integrate one or more scripts into bashrc with a mouse click.

How to use:

Load a file:

If you already have an alias/function script setup you can import it by selecting the file on the first load, or going to "Load File" later. Alias Manager will try to back this file up before saving it. If you don't have a file to load, just select "Cancel" on the first run, or "New File" later, and Alias Manager will create a blank script to start from. Alias Manager tries to detect all aliases, functions, and exports in existing scripts, but due to the difference in coding styles it's possible for Alias Manager to 'miss a few things'. In this case you can either start from a blank file, or convert your existing script into Alias Manager style. This style is noted in the header of any Alias Manager generated script.

Save a file:

Back ups are made because Alias Manager uses a specific style to read and write scripts. You will always have your backup there in case you don't like the style and plan on editing scripts manually later. To save a file make sure you have at least one alias or function in the script, and all items are saved using 'Save Command'. If 'Auto-Save' is checked Alias Manager will save the file any time you save a command. Otherwise, you will need to click 'Save File' or 'Save File As'. This generates a BASH script that can be integrated with bashrc.

Exports:

Aliases are automatically exported, but with functions you can decide whether or not the current function is an export or not by checking/unchecking "Exported". If a function is exported it will be available to use outside of the current script file. This allows you to run multi-line commands using a short alias name. If a function is NOT exported, the function is only available from within the current script. This is useful for 'helper-functions' that may help other exported functions.

Auto Save:

When "Auto Save" is checked, the script file will be saved any time a command is saved. Without auto save you must manually save the file for changes to persist. You may edit multiple commands before saving. Once Alias Manager is closed, any changes that have not been saved will not persist. Any unsaved changes will not be available from the BASH prompt when using integrated scripts.

External Editor:

You can quickly open the current script file in the external editor of your choice by selecting "External Editor". If you have not chosen an external editor, Alias Manager will ask you to select one and save any valid selection to the settings for future use. This will allow you to see the actual script contents, and get an idea about Alias Manager's coding-style for generated scripts. You may also edit the script externally, but be careful not to stray too far from the current style. Major changes in style may make Alias Manager read the file incorrectly, and could lead to loss of commands/comments.

Easy Integration:

Enable Integration:

When you enable integration a single line is added to your bashrc (detected by looking in /home first, then /etc for .bashrc or bash.bashrc). This line simply says 'if /installdir/aliasmgr_scripts.sh exists then run /installdir/aliasmgr_scripts.sh'. The aliasmgr_scripts.sh is responsible for running any and all scripts that are integrated using Alias Manager. A message will be displayed at BASH start-up telling you which files are loaded by Alias Manager.

Integrate Script:

With a script open, select "Integrate". This will add the currently opened script to Alias Manager's list of 'integrated scripts', and generate a new aliasmgr_scripts.sh containing all currently integrated scripts.

DeIntegrate Script:

With a script open, select "DeIntegrate". This will remove the currently opened script from Alias Manager's list of 'integrated scripts', and generate a new aliasmgr_scripts.sh. If no files are integrated, then aliasmgr_scripts.sh does absolutely nothing.

Check:

You can check to see if the currently opened script is integrated by selecting "Check". This will search all integrated scripts for the currently opened file name and report it's 'integrated status'.

List Integrated:

Whether or not integration is enabled, this will scan bashrc and Alias Manager's integrated scripts and report a list of all script files that are ran (. /script.sh) or sourced (source /script.sh) inside bashrc.

Clone this wiki locally