markdown · 2322 bytes Raw Blame History

gitswitch C

(noun) : SSDD for your SSDs' SDDM

what is this?

this is another port. The original python version introduced some oddities with the ssh-agent. The C implementation avoids those oddities.

Usage: gitswitch [OPTIONS] [COMMAND] [ARGS]

Commands:
  add                  Add new account interactively
  list, ls             List all configured accounts
  remove <account>     Remove specified account
  status               Show current account status
  doctor, health       Run comprehensive health check
  config               Show configuration file information
  init <shell>         Emit shell integration (fish|bash|zsh|sh)
  <account>            Switch to specified account

Options:
  --global, -g         Use global git scope
  --local, -l          Use local git scope (default)
  --dry-run, -n        Show what would be done without executing
  --verbose, -V        Enable verbose output
  --debug, -d          Enable debug logging
  --color, -c          Force color output
  --no-color, -C       Disable color output
  --help, -h           Show this help message
  --version, -v        Show version information

Examples:
  gitswitch add                    # Add new account interactively
  gitswitch list                   # List all accounts
  gitswitch 1                      # Switch to account ID 1
  gitswitch work                   # Switch to account matching 'work'
  gitswitch remove 2               # Remove account ID 2
  gitswitch doctor                 # Run health check

shell integration

gitswitch maintains a stable SSH agent socket at a fixed path so your shell can point SSH_AUTH_SOCK at it once and have every gitswitch <account> switch transparently. Add the matching line to your shell rc:

# ~/.config/fish/config.fish
gitswitch init fish | source
# ~/.bashrc
eval "$(gitswitch init bash)"
# ~/.zshrc
eval "$(gitswitch init zsh)"

The snippet guards on the socket's existence, so sourcing it before the first switch (or after /tmp has been wiped) is a silent no-op rather than an error.

Migrating from the Python gitswitch? The old gitswitch --ssh-agent-info invocation still works as a compat alias that auto-detects your shell from $SHELL, but prefer the explicit init <shell> form in new rc files.

View source
1 # gitswitch C
2 (noun) : SSDD for your SSDs' SDDM
3
4 ## what is this?
5 this is another port. The original python version introduced some oddities with the ssh-agent. The C implementation avoids those oddities.
6
7 ```
8 Usage: gitswitch [OPTIONS] [COMMAND] [ARGS]
9
10 Commands:
11 add Add new account interactively
12 list, ls List all configured accounts
13 remove <account> Remove specified account
14 status Show current account status
15 doctor, health Run comprehensive health check
16 config Show configuration file information
17 init <shell> Emit shell integration (fish|bash|zsh|sh)
18 <account> Switch to specified account
19
20 Options:
21 --global, -g Use global git scope
22 --local, -l Use local git scope (default)
23 --dry-run, -n Show what would be done without executing
24 --verbose, -V Enable verbose output
25 --debug, -d Enable debug logging
26 --color, -c Force color output
27 --no-color, -C Disable color output
28 --help, -h Show this help message
29 --version, -v Show version information
30
31 Examples:
32 gitswitch add # Add new account interactively
33 gitswitch list # List all accounts
34 gitswitch 1 # Switch to account ID 1
35 gitswitch work # Switch to account matching 'work'
36 gitswitch remove 2 # Remove account ID 2
37 gitswitch doctor # Run health check
38 ```
39
40 ## shell integration
41
42 gitswitch maintains a stable SSH agent socket at a fixed path so your shell
43 can point `SSH_AUTH_SOCK` at it once and have every `gitswitch <account>`
44 switch transparently. Add the matching line to your shell rc:
45
46 ```fish
47 # ~/.config/fish/config.fish
48 gitswitch init fish | source
49 ```
50
51 ```bash
52 # ~/.bashrc
53 eval "$(gitswitch init bash)"
54 ```
55
56 ```zsh
57 # ~/.zshrc
58 eval "$(gitswitch init zsh)"
59 ```
60
61 The snippet guards on the socket's existence, so sourcing it before the
62 first switch (or after `/tmp` has been wiped) is a silent no-op rather than
63 an error.
64
65 > **Migrating from the Python gitswitch?** The old `gitswitch --ssh-agent-info`
66 > invocation still works as a compat alias that auto-detects your shell from
67 > `$SHELL`, but prefer the explicit `init <shell>` form in new rc files.
68