Expand your binary functionality by adding custom handlers
or basically an advanced alias manager
-
Mimic with custom alias
git sync "WIP: sync state"
- sync current source state with remote repository
It is an interceptor or <ALIAS>sync
forgit
<MIMIC>
Under the hood is does:
git add .
git commit -am "WIP: sync state"
git push
-
Mimic with shorthand for specific key
npx init react-application
- create react project
It is an interceptor or <ALIAS>init
fornpx
<BINARY>
Under the hood is does:
npx create-react-app react-application
-
Intercept existing command
git pull
- pull source from remote repository
Under the hood is does:
git status
- to get current branch
git stash push
- to save current WIP
git pull origin <branch_from_status>
- to pull source
git stash pop
- to bring back WIP
date
- Indicate when it was done
*NOTE
to run originalgit pull
prepend exclamation mark [!]
git ! pull
- will ignorepull
<ALAIS> and run originalgit pull
MIM_PATH="~/.local/share/mimpm"
git clone ${CURRENT_REPO_URL} ${MIM_PATH:-~/.mimpm}
cd ${MIM_PATH:-~/.mimpm}
./install.sh
It will add required exports to your .bashrc
file
[MIMIC] - is an excutable that handle calls
can be compiled binary or a shell script
[ALIAS] - is a key for a [MIMIC]
E.g.:
[MIMIC] [ALIAS]
ls -la
ip route
git status
mimpm <OPTION> [param1[ param2[...paramN]]]
--mimic-set-editor <bin_path>
- define preferred editor to use
example: mimpm --mimic-set-editor vi
--mimic-add <mimic> [<bin_path>]
- crate a [BINARY] interceptor
example: mimpm --mimic-add git /usr/bin/git
mimic git
binary located at /usr/bin/git
Then create aliases
git --mimic-add sync
- will create and open alias for editing
--mimic-remove <alias>
- remove alias
example: git --mimic-remove sync
- will remove sync alias file
--mimic-edit <alias>
- edit alias in preferred editor
example: git --mimic-edit sync
--mimic-ls
- list defined aliases for current mimic
example:
~$ git --mimic-ls
ca commit all
cam Commit all with simple message
ck checkout
lsb list all branches
lsc list commits -> log --oneline
lsf list files staged for commits
lsm list merge commits
lst list repo tags
pull pull current branch from origin
push push current branch to origin
st show current repository status
sync sync current state with remote. Push everything to remote
--mimic-help [<alias>]
- show help for given mimic alias
example:
~$ git --mimic-help sync
sync current state with remote. Push everything to remote
USAGE: git sync "Commit message"
--mimic-export [arg1[ arg2[ argN]]]
- export mimic alias for example to share with friend
mimpm --mimic-export git
- export all defined git aliases
mimpm --mimic-export git:sync
- export defined git sync alias
example: mimpm --mimic-export git npx:init npm:reload
--mimic-import <alias_arch.tar>
- import mimic alias archive
--mimic-proxy
- create an interceptor for all calls except already defined aliases
mimpm --mimic-proxy npm
- will create a proxy interceptor
means any npm
calls will be routed to the proxy interceptor first
--mimic-disable <alias>
- temporary disable mimic for binary
example: mimpm --mimic-disable git
--mimic-enable <alias>
- enable mimic