Home

Awesome

Run Scripts Extension for Modal File Manager

This extension for Modal File Manager gives the user the ability to create and run scripts. All scripts are kept in the ~/.config/modalfilemanager/scripts/ directory. Upon loading the extension for the first time, this directory is created and some example scripts are copied to it.

To run this extension, you have to have Modal File Manager version 0.1.4 or greater. This is due to additions to the extension API needed for this extension to work.

Before a script is ran, some environment variables are created in the run environment. These are in addition to the environment variables setup in the preferences. These are:

Environment VariableDescription
CURRENT_DIRECTORYThe current directory for the cursor
CURRENT_FILEThe current file name for the cursor
LEFT_PANEThe directory of the left file pane
LEFT_PANE_SELECTED_FILEThe last highlighted file in the left file pane
RIGHT_PANEThe directory of the right file pane
RIGHT_PANE_SELECTED_FILEThe last highlighted file in the right file pane
FILES_SELECTEDA newline separated list of selected files

Commands available in the Command Prompt

The following commands are available to use in the Command Prompt:

CommandDescription
Run ScriptA list of scripts will be given to chose from. That script will be ran.
Run NPM ScriptA list of npm scripts in the current directory will be given to choose from. That script will be ran.
Run Mask ScriptA list of mask scripts in the current directory will be given to choose from. That script will be ran.
Create ScriptThe user will be prompted for a new script name. That script will be created, populated with a template, and the user's editor will open the script.
Toggle Show OutputToggles the displaying of the results from running the script.
Run Command LineThis will run a command line just like a script.
Edit ScriptA list of scripts will be given to choose from. That script will be opened in the user's defined editor.
Go To Scripts DirectoryThis will open the current pane in the Modal File Manager to the scripts directory.
Install Example ScriptsThis will install the example scripts into the scripts folder