Skip to content

Latest commit

 

History

History
69 lines (49 loc) · 6.69 KB

README.md

File metadata and controls

69 lines (49 loc) · 6.69 KB

Tools for Automation

  • msr + nin for file processing + data mining.
  • vscode-msr for code mining + change code + alias for all terminals/IDEs.
  • Alias Tools
    • Besides tools above, introduce alias tools to help simplify frequently used operations like git operations (like gpm / gdm-l / etc.)

Why Use Custom Alias or Normal Alias

  • Save lifetime for frequently used tools and command lines - call the short alias/doskeys names.
  • Write alias once and for all - for current + future vscode on Windows + Linux + MacOS plus Docker Containers in them.

When Should Use vscode to Update Alias

Needless to always use/open vscode (with vscode-msr) - unless you changed/added new alias/doskeys.

  • For normal aliases:
    • Type update-alias to reload changes for old/existing terminals out-of vscode.
  • For custom aliases (see difference to normal alias):
    • Open vscode to auto update aliases, then type update-alias to reload changes for old/existing terminals out-of vscode.
  • If your changes involve nested calling to other alias/doskeys:
    • Open vscode and take 1 click to dump aliases to script files, then type update-alias to reload changes for old/existing terminals out-of vscode.

Create + Find + Update + Merge + Remove Alias

  • Create alias:
    • See Create Custom Alias and use to-alias-body to help transform multi-line alias body to one-line JSON.
  • Find alias/doskeys details (command line):
    • Use falias to find custom alias like falias update-vsc-alias , this will output 3 lines: aliasName + aliasBody + description. falias-example.png
      • Use grep-vsc like grep-vsc -t falias to find location in vscode settings.json to view or update.
    • Use alias/malias to find normal alias like alias gpc or malias gph or malias gca or malias gca= and etc.
      • Of-course, you can also find custom alias like alias gdm-ml without description info.
  • Update alias groups from another settings.json file:
  • Remove alias:
    • Use rm-alias to remove alias + its script file (if dumped) like: rm-alias {alias-name}.

Difference between Custom Alias and Normal Alias

  • Normal alias: Easy to write - See Cook Normal Alias for more guide/details.

  • Custom alias: Easy to sync - See Create Custom Alias for more guide/details especially use to-alias-body to:

    • Help transforming multi-line alias body to one-line JSON.
    • Help escaping special characters (including Windows path slashes) in alias body.

Notes for Writing Alias Body with PowerShell for Windows

When you writing aliasBody like PowerShell -Command "{command lines body}" (or pwsh -Command "xxx"), follow these rules to avoid unexpected errors:

  • Do not name a variable starting with "b g l t" (like $tableName / $list / etc.) in the {command lines body} to avoid doskeys conflict.
  • Be care of $1 / $2 conflicts with Regex replacement (capture group) in the {command lines body}.
    • Use msr -t "matched (group)" -o "matched \1" ... to fix conflict of $1 with \1.
  • Try to use single quotes ' instead of double quotes " in the {command lines body}.

Follow examples in custom-alias/settings.json to write aliasBody with PowerShell, and don't forget to use to-alias-body to help transform command lines.

Appendix

Install Common Tools if Needed

Hot Reload Environment Variables for New Alias or Tools on Windows

  • Type reload-env for any new tools (like jq) if you failed to found.
  • Type add-user-path {new-tool-folder} if you still cannot find the new tool.