GithubHelp home page GithubHelp logo

gabrul34466 / gh-profile Goto Github PK

View Code? Open in Web Editor NEW

This project forked from gabe565/gh-profile

0.0 0.0 0.0 1.18 MB

:octocat: Use multiple GitHub accounts with the gh cli.

License: MIT License

Go 100.00%

gh-profile's Introduction

gh-profile

Build Go Report Card

Work with multiple GitHub accounts using the gh cli.

gh-profile demo

Installation

gh extension install gabe565/gh-profile

Usage

See the generated usage docs, or see a summary of each subcommand below.

Note As of v2.26.0, the gh cli now uses secure auth tokens by default. Secure auth tokens are not yet supported by gh-profile, so when logging into GitHub, make sure to run:
gh auth login --insecure-storage

  • gh profile create [NAME]: Creates a new profile.

    Details

    Aliases: c, new, add

    Params:

    • NAME is optional. If not set, command will run interactively.

    Example:

    $ gh profile create example
    โœจ Creating profile: example
    ๐Ÿ”ง Activating global profile: example
  • gh profile switch [NAME] [--local-dir]: Activates a profile.

    Details

    Aliases: activate, active, sw, s

    Params:

    • NAME is optional. If not set, command will run interactively.
      • If set to -, gh-profile will switch back to the previous profile.
    • --local-dir/-l activates the profile only for the current directory.
      • For this to work, you must install a per-directory env tool like direnv.

    Example:

    $ gh profile switch example
    ๐Ÿ”ง Activating global profile: example
  • gh profile rename [NAME] [NEW_NAME]: Renames a profile.

    Details

    Aliases: mv

    Params:

    • NAME and NEW_NAME are optional. If not set, command will run interactively.

    Example:

    $ gh profile rename example example2
    ๐Ÿšš Renaming profile: example to example2
    ๐Ÿ”ง Activating global profile: example2
  • gh profile list: Lists all profiles. Active profile will be bold with a green check.

    Details

    Aliases: ls, l

    Example:

    $ gh profile list
    โœ“ example
      gabe565
  • gh profile remove [NAME]: Removes a profile.

    Details

    Aliases: delete, rm, d

    Params:

    • NAME is optional. If not set, command will run interactively.

    Example:

    $ gh profile remove example2
    ๐Ÿ”ฅ Removing profile: example2
  • gh profile show: Prints the active profile name. If no profile is active, nothing will be printed. Useful as a prompt element.

    Details

    Example:

    $ gh profile show
    example

Prompt Element

gh profile show is useful for displaying the current profile in your shell's prompt. This command will work for any prompt, but configuration with Powerlevel10k is provided below.

Powerlevel10k

Powerlevel10k ships with a custom formatter for git repositories. This formatter can be easily modified to show the current profile.

  1. Edit ~/.p10k.zsh.
  2. Find the my_git_formatter function
  3. Find the line local res
  4. Add the following below that line:
        local profile="$(gh profile show 2>/dev/null)"
        [[ -n "$profile" ]] && res+="$profile "

Now, the current profile will be shown when you are in a git repo!

Example

Before After
Before After

gh-profile's People

Contributors

gabe565 avatar renovate[bot] avatar dependabot[bot] avatar dariuszporowski avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.