Coder Social home page Coder Social logo

wakatem / hubswitch Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 0.0 370 KB

A CLI tool for windows that allows you to seamlessly switch between different github accounts

License: MIT License

Python 98.75% Batchfile 1.25%
cli credential-manager git github windows python

hubswitch's Introduction

drawing

HubSwitch

Command-line tool for seamlessly managing and switching between multiple GitHub accounts on a single machine, ideal for developers with both personal and professional profiles.

How to Use

Before using HubSwitch, ensure that your GitHub accounts' details are properly set up in the configuration file (sampleConfig.json). The configuration should include the GitHub username, email, and Personal Access Token (PAT) for each account. Ensure to store the path of the JSON file as an environment variable exactly named HubSwitch.
Note: store the config in a secure place as it contains sensitive information.

Setup

  1. Define the HubSwitch environment variable on your system, pointing to the location of your configuration file.
  2. Edit sampleConfig.json to include your GitHub account details and rename file to preference.

Example sampleConfig.json:

{
    "version": 1.0,
    "accounts": {
        "work1": {
            "account_name": "Work",
            "username": "work_username",
            "email": "[email protected]",
            "PAT": "your_personal_access_token"
        }
        // ... Add other accounts as needed
    },
    "current": "work1"  // Set the default activated account ID
}
  1. To run the hubswitch command through terminal, add the path of the repo folder to PATH environment variable (either User or System)

Basic Commands

Activate an Account

To activate an account, use the command activate followed by the account ID specified in your config file.

hubswitch activate work1
python main.py activate work1

View Current Account

To view the currently activated account, use the command current

hubswitch current
python main.py current

List All Accounts

To list all accounts available in your configuration file, use the command accounts.

hubswitch accounts
python main.py accounts

View Config Schema

To view the expected schema of your configuration file, use the command schema.

hubswitch schema
python main.py schema

Modules Used

To build the CLI tool, this project leverages the following python modules:

  • Win32Cred: To access windows credentials.
  • Typer: For creating the command-line interface.
  • Rich: For enhanced printing in the console, including JSON.
  • jsonschema: To validate JSON data against a predefined schema.

hubswitch's People

Contributors

wakatem avatar

Stargazers

 avatar  avatar

Watchers

 avatar  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.