Package: shcmdmgr
DISCLAIMER (WORK IN PROGRESS):As of May 2020 this project is work in progress.
The alpha release is planned for June.ItISdesigned tomake a clear overview of custom-made commandsprovide a common user interface for the commandsprovide a clear way to setup commands which work well with this toolItIS NOTdesigned toprovide standard functions or libraries to be used in the custom-made commandscheck correctness or analyse the commandsTODOsrefine the structure of modulesfix over-escaping, e.g. in 'proot' test commandimprove search (not only one whole regex)help for argumentscompletion for argumentsthink of possible project configuration variablesfix optional parameter load orderrelease to pypi and get it tested by somebody else(seems hard) copy the command into command line instead of executing itInstallationFor stable release, runpip3installshcmdmgrBasic usageUsecmd -s(orcmd --save) to catalogue a command. For examplelsb_release -a.$lsb_release-a
DistributorID:Ubuntu
Description:Ubuntu20.04LTS
Release:20.04
Codename:focal

$cmd--save
Thecommandtobesaved:lsb_release-a%notethatthiswaspre-filledfromhistoryAlias:sysversion
Shortdescription:ShowsthesystemversionRun the command either by invoking the alias$cmdsysversion
DistributorID:Ubuntu
Description:Ubuntu20.04LTS
Release:20.04
Codename:focalor use searchcmd -f(orcmd --find) to find and run the command.$cmd--find========================================query$system%itemsmatchingtheregexaredisplayed
---1------------------------------
cmd:do-release-upgrade
des:Upgradesthesystemtothenewestreleasedversion
---2------------------------------
cmd:lsb_release-a
des:Showsthesystemversion========================================query$2%choosethecommandbyenteringitsnumber
runcommand:lsb_release-a
DistributorID:Ubuntu
Description:Ubuntu20.04LTS
Release:20.04
Codename:focalTo edit the command catalogue runcmd --edit(orcmd -e) which runs$EDITOR ./<script_location>/commands.jsoncommand or open and edit the catalogue file manually.$cmd--edit
%The"$EDITOR"opensthecontentsimilartothefollowing[{"command":"lsb_release -a","description":"Show the version number of the system","alias":"sysversion","creation_time":"2020-04-11 00:24:27"},{"command":"do-release-upgrade","description":"Upgrades the system to the newest released version","alias":"sysupgrade","creation_time":"2020-04-11 00:25:08"}]CompletionCompletion is supported inbashandzshshells, and must be enabled explicitly.
Installing the completion is the matter of adding file-source to the RC file.The correct command can be emited by invoking--completion <shell>command.
So you can use the following for bash or zsh respectively.cmd--completionbash>>~/.bashrc
cmd--completionzsh>>~/.zshrcAdvanced (work in progress)InstallationTo get the latest (non-stable) development version run the following.pip3installgit+https://github.com/vaclavblazej/shell-command-manager.gitFor development setup you may fork the repository, clone it, and create a symlink.gitclonegit@github.com:vaclavblazej/shell-command-manager.git
ln-s"$PWD/shell-command-manager/bin/cmd.sh"~/bin/cmdPartsWe manage custom scripts, their help, and completion.executionhelpcompletionOne function for all three because they have too much in common.
Flags used to determine what we want to return.All three variants are delegated lower (into arguments) and in the lowest level, we return (or do) the wanted result.
In execution, we perform the task.
In help and completion, we set the result into the relevant location.ExecutionThe custom script should be an executable file.HelpHelp is invoked by callingscript --help <arguments>where arguments are in the precise form as they would have been without the--helpargument.
It prints a string to standard output which describes what our current command does, and if there are any expected arguments.CompletionCompletion is invoked by callingscript --complete <arguments>and prints out the list of words which are sensible arguments in the next places.
The last argument is considered asargument prefixand is used to filter out possible words.
If no filtering is wanted, the last argument should be empty-string.