Applications
Configure the applications that Git-Tool will launch for you when opening a repo.
Git Tool has the ability to launch applications within the context of your repositories. This is useful when you want to quickly open a shell or your favourite editor and start working, however you can also add a wide range of other applications there.
The quickest way to add applications to your config is to use the gt config add command to install apps from the registry. If your favourite app isn't there already, feel free to add it by following the contribution guide.
The first application in your config file will be launched by default if you do not specify an application in your command.
Here's an example of an app which uses all of the configuration options to launch a Visual Studio developer command prompt in your repo. For more information on what each of these properties do, keep reading.
1
apps:
2
- name: vs
3
command: powershell.exe
4
args:
5
- "-NoExit"
6
- "-Command"
7
- "& { Import-Module VSSetup; $vs = Get-VSSetupInstance | Select-VSSetupInstance -Latest; Import-Module (Join-Path $vs.InstallationPath $env:VSDEVSHELL_PATH); Enter-VsDevShell -VsInstallPath $vs.InstallationPath -StartInPath '{{ .Target.Path }}' }"
8
environment:
9
- VSDEVSHELL_PATH=Common7\\Tools\\Microsoft.VisualStudio.DevShell.dll
Copied!

Configuration

Applications in your Git-Tool configuration file have a name and command. The name is what you will use when launching the application (such as in gt o my-app my-repo) and the command is the program which will be executed when you do.

name

This is the name of the app which you will use when running commands like gt o my-app and gt s my-app. Usually it's a good idea to make this short and easy to type.
1
name: bash
Copied!

command

This is the program which will be launched by Git-Tool for this app entry. You can use the name of the program if it exists on your $PATH or an absolute path if it does not.
1
command: /usr/bin/bash
Copied!
Git-Tool will set the current working directory of the program to that of the scratchpad or repo you are launching it in. If you need to change this, you can do so using a spawned shell and cd.

args

If you wish to pass arguments to your program, you can provide an array of them here. This can be very useful for setting up a shell environment (if you need that) or simply for avoiding the creation of a wrapper script.
1
args:
2
- '-c'
3
- 'echo $MESSAGE'
Copied!

environment

Sometimes you need to set up environment variables for the program you are launching and this is the way to do it. Simply provide an array of environment variables you wish to expose to the application (overriding those in Git-Tool's environment if they conflict) and you're good to go.
1
environment:
2
- 'MESSAGE=Hello {{ .Target.Name }}'
Copied!
Did you notice that .Target.Name? Git-Tool's apps (and services) support templates, so you can gather information about the repository or scratchpad you're targeting and tailor your call appropriately.
Last modified 20d ago