Skip to content

Command Line Connection

JDX50S edited this page Feb 18, 2023 · 1 revision

The standard CLI provides the user with the ability to install, activate, and uninstall, while also providing a number of other optimizing / controlling features.

Where the CLI provides the full functionality of GHPM, the Command Line Connection only provides the main features, such as installing, executing, and uninstalling. But does not provide user settings or any other forms of interaction with the backend.

If you want to enable the CLC. It is quite straightforward, within the CLI, you will head into Settings > User > Enable Command Line Interface. This will enable the gh command on MacOS, other OS may not be compatible with the configuration command:

echo 'alias gh="cd {User.UserProfile.SourceDirectory} &&python3 gh.py"' >> ~\\.zshrc && exec zsh -l'''

To break down the previous command: note: the user does not need to run that command directly, this simply explains the process used.

  1. The >> operator appends the output of the echo command to the file ~/.zshrc. ~ represents the user's home directory, and .zshrc is a file that is executed when the user starts a new terminal session. The >> operator appends the output to the end of the file, rather than overwriting the existing contents.

  2. cd is the change directory command, which changes the current working directory to the directory specified in {User.UserProfile.SourceDirectory}. This is a variable that contains the path to the source directory of GHPM.

  3. python3 gh.py is the command that will be executed after the cd command. It runs the gh.py script using the Python 3 interpreter.

  4. Finally, exec zsh -l is executed. This runs a new instance of the zsh shell with the -l option, which means it is run as a login shell. This will ensure that the changes made to the .zshrc file are loaded and the new gh alias is available in the new shell session.

Now when gh is run in the command line, it will automatically launch the help menu for the CLC.

Functions

  • -I -> Install (arg{repo})
  • -IL -> Install Local (arg{dir})
  • -LA -> List All Installs
  • -LL -> Launch Local Directory
  • -LG -> Launch Git Project
  • -LC -> Launch Advanced Projects
  • -UG -> Uninstall GitHub Projects
  • -UL -> Uninstall Local directories

Examples

  • gh -I https://github.com/SomeUser/Something.git -> Installs the repo following -I.
  • gh -IL /Users/Someone/Something -> Imports all of the files within the specified directory.
  • gh Help
Clone this wiki locally