Skip to main content

Git-Profile-cli is a CLI tool that simplifies switching between multiple Git profiles—user names, emails, and SSH keys—ideal for developers working on various projects or with multiple organizations.

Project description

git-profile-cli

git-profile-cli is a command-line tool that simplifies the management of multiple Git profiles. It allows developers to effortlessly switch between different Git configurations, including user names, email addresses, and SSH keys. This tool is perfect for developers who work on various projects or contribute to multiple organizations.

Features

  • Manage multiple Git profiles with ease
  • Switch between profiles quickly
  • Automatically update Git global configuration
  • Configure SSH keys for different profiles
  • Interactive profile selection and management
  • Extensible and modular codebase

Installation

From PyPI (Recommended)

pip install git-profile-cli

From Source

  1. Clone the repository:

    git clone https://github.com/tux86/git-profile-cli.git
    cd git-profile-cli
    
  2. Install the package:

    pip install .
    

Usage

After installation, you can use Git profile cli with the git-profile command:

List all profiles

git-profile list

Display the current profile

git-profile current

Add a new profile

git-profile add

You'll be prompted to enter the profile details interactively.

Modify an existing profile

git-profile modify <profile_name>

Select a profile

git-profile [select] [profile_name]

You can use this command in several ways:

  • git-profile select work: Directly selects the 'work' profile
  • git-profile select: Prompts you to choose a profile interactively
  • git-profile: Same as git-profile select, prompts you to choose a profile interactively

Examples:

git-profile select work  # Directly selects the 'work' profile
git-profile select  # Prompts you to choose a profile interactively
git-profile  # Also prompts you to choose a profile interactively

Note: Running git-profile without any command is equivalent to git-profile select and will prompt you to choose a profile interactively.

Delete a profile

git-profile delete

You'll be prompted to select the profile to delete.

Specify a custom configuration file

You can use a custom configuration file by using the --config or -c option:

git-profile -c /path/to/custom/config.yaml <command>

Configuration

Git-Profile-Cli uses a YAML configuration file to store profile information. By default, it's located at ~/.git-profile/config.yaml. Each profile in the configuration file has the following structure:

profiles:
  - name: work
    user_name: John Doe
    user_email: john.doe@company.com
    ssh_key_path: ~/.ssh/id_rsa_work
  - name: personal
    user_name: John Doe
    user_email: john.doe@gmail.com
    ssh_key_path: ~/.ssh/id_rsa_personal

Development

To set up the development environment:

  1. Clone the repository
  2. Create a virtual environment:
    python -m venv venv
    source venv/bin/activate  # On Windows use `venv\Scripts\activate`
    
  3. Install development dependencies:
    pip install -r requirements.txt
    

Running Tests

To run tests, use:

python -m unittest discover tests

Building the Package

To build the package, use:

python -m build

Contributing

Contributions are welcome! Here are some ways you can contribute to this project:

  1. Report bugs and suggest features by opening issues.
  2. Submit pull requests with bug fixes or new features.
  3. Improve documentation or add examples.
  4. Share the project and help others.

Authors

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

  • Thanks to all contributors who have helped to improve this project.
  • Inspired by the need for easy management of multiple Git profiles.
  • Hat tip to anyone whose code was used as inspiration.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

git_profile_cli-1.0.2.tar.gz (9.7 kB view details)

Uploaded Source

Built Distribution

git_profile_cli-1.0.2-py3-none-any.whl (8.5 kB view details)

Uploaded Python 3

File details

Details for the file git_profile_cli-1.0.2.tar.gz.

File metadata

  • Download URL: git_profile_cli-1.0.2.tar.gz
  • Upload date:
  • Size: 9.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.15

File hashes

Hashes for git_profile_cli-1.0.2.tar.gz
Algorithm Hash digest
SHA256 861ebe537f1291c3e06952373cb7d55134c397f84c43ae8746e33602169be9d7
MD5 10dcf6dcb0d10f1cbf85e8795f7c2906
BLAKE2b-256 73eedc7238b609f8d6c26814cd15c5e3f5aa39267ed3b6a71b5b190b2ef37efa

See more details on using hashes here.

File details

Details for the file git_profile_cli-1.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for git_profile_cli-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c97b04d306c77da5e6620b7f41ca574b1aec2a921aefbe82f70831d49021d5eb
MD5 074053cb37e0b34277e648170488c5c1
BLAKE2b-256 7333031b51b336b5d106413833d9c90ccf8392dc0d3759f13fb770e4251f003a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page