-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix global flag recognition in switch command
- Implement manual flag checking for --global and -g flags - Add debug logging to track argument parsing and flag detection - Modify switchUser function to accept isGlobal as a parameter - Improve error messages for better user guidance - Enhance debug output for easier troubleshooting This commit resolves an issue where the --global flag was not being recognized in the switch command, causing incorrect behavior when attempting to switch global Git identities.
- Loading branch information
Test Name
committed
Aug 21, 2024
1 parent
f51fde0
commit 9ab10a1
Showing
4 changed files
with
330 additions
and
132 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
# Contributing to chicle | ||
|
||
First off, thank you for considering contributing to chicle! | ||
|
||
## Code of Conduct | ||
|
||
By participating in this project, you are expected to remain civil. | ||
|
||
## How Can I Contribute? | ||
|
||
### Reporting Bugs | ||
|
||
This section guides you through submitting a bug report for chicle. Following these guidelines helps maintainers and the community understand your report, reproduce the behavior, and find related reports. | ||
|
||
- Use a clear and descriptive title for the issue to identify the problem. | ||
- Describe the exact steps which reproduce the problem in as many details as possible. | ||
- Provide specific examples to demonstrate the steps. | ||
|
||
### Suggesting Enhancements | ||
|
||
This section guides you through submitting an enhancement suggestion for chicle, including completely new features and minor improvements to existing functionality. | ||
|
||
- Use a clear and descriptive title for the issue to identify the suggestion. | ||
- Provide a step-by-step description of the suggested enhancement in as many details as possible. | ||
- Provide specific examples to demonstrate the steps or point out the part of chicle which the suggestion is related to. | ||
- Explain why this enhancement would be useful to most chicle users. | ||
|
||
### Your First Code Contribution | ||
|
||
Unsure where to begin contributing to chicle? You can start by looking through these `beginner` and `help-wanted` issues: | ||
|
||
- [Beginner issues](https://github.com/permadart/chicle/labels/beginner) - issues which should only require a few lines of code, and a test or two. | ||
- [Help wanted issues](https://github.com/permadart/chicle/labels/help%20wanted) - issues which should be a bit more involved than `beginner` issues. | ||
|
||
### Pull Requests | ||
|
||
- Fill in the required template | ||
- Do not include issue numbers in the PR title | ||
- Include screenshots and animated GIFs in your pull request whenever possible. | ||
- Follow the [Go Code Review Comments](https://github.com/golang/go/wiki/CodeReviewComments) | ||
- End all files with a newline | ||
|
||
## Styleguides | ||
|
||
### Git Commit Messages | ||
|
||
- Use the present tense ("Add feature" not "Added feature") | ||
- Use the imperative mood ("Move cursor to..." not "Moves cursor to...") | ||
- Limit the first line to 72 characters or less | ||
- Reference issues and pull requests liberally after the first line | ||
|
||
### Go Styleguide | ||
|
||
All Go code is linted with [golangci-lint](https://golangci-lint.run/). | ||
|
||
## Additional Notes | ||
|
||
### Issue and Pull Request Labels | ||
|
||
This section lists the labels we use to help us track and manage issues and pull requests. | ||
|
||
- `bug` - Issues for bugs in the code | ||
- `enhancement` - Issues for new features or improvements | ||
- `documentation` - Issues related to documentation | ||
- `good first issue` - Good for newcomers | ||
|
||
## Getting Help | ||
|
||
If you need help, you can ask questions on our [issues page](https://github.com/permadart/chicle/issues). | ||
|
||
Thank you for contributing to chicle! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,7 @@ chicle is a platform-agnostic command-line tool for managing multiple Git identi | |
- Ensures unique aliases across global and local identities | ||
- Supports both global and repository-specific identity management | ||
- Version checking functionality | ||
- Verbose mode for detailed output | ||
|
||
## Installation | ||
|
||
|
@@ -47,12 +48,31 @@ If you prefer to install from source or Homebrew is not available: | |
|
||
## Usage | ||
|
||
### Global vs Local Operations | ||
|
||
chicle supports both global and local Git identity management: | ||
|
||
- Global identities are used across all Git repositories on your system. | ||
- Local identities are specific to a single Git repository. | ||
|
||
When using local operations, ensure you're in a Git repository. For global operations, use the `--global` flag or the appropriate subcommand. | ||
|
||
### Verbose Mode | ||
|
||
To enable detailed output for any command, use the `--verbose` or `-V` flag: | ||
|
||
```bash | ||
chicle --verbose [command] | ||
``` | ||
|
||
### Create a new SSH key and identity (globally) | ||
|
||
```bash | ||
chicle create --alias user1 --email [email protected] --name "John Doe" --global | ||
``` | ||
|
||
Alias: `chicle add` | ||
|
||
### Create a new SSH key and identity (for the current repository) | ||
|
||
```bash | ||
|
@@ -77,18 +97,24 @@ chicle create --alias user2 --email [email protected] --name "Jane Doe" --key ~/ | |
chicle switch user1 --global | ||
``` | ||
|
||
Aliases: `chicle use`, `chicle switch-global` | ||
|
||
### Switch Git user (for the current repository) | ||
|
||
```bash | ||
chicle switch user1 | ||
``` | ||
|
||
Alias: `chicle switch-local` | ||
|
||
### Delete a Git identity (globally) | ||
|
||
```bash | ||
chicle delete user1 --global | ||
``` | ||
|
||
Alias: `chicle remove` | ||
|
||
### Delete a Git identity (local) | ||
|
||
```bash | ||
|
@@ -101,6 +127,14 @@ chicle delete user1 | |
chicle list | ||
``` | ||
|
||
Alias: `chicle ls` | ||
|
||
### Configure default behaviors | ||
|
||
```bash | ||
chicle config --always-global | ||
``` | ||
|
||
### Check chicle version | ||
|
||
```bash | ||
|
@@ -113,14 +147,24 @@ chicle -v | |
|
||
## Important Notes | ||
|
||
- When creating or switching to a local identity (without the `--global` flag), you must be inside a Git repository. If you're not in a Git repository, chicle will return an error and prompt you to use the `--global` flag. | ||
- When creating or switching to a local identity, you must be inside a Git repository. If you're not in a Git repository, chicle will return an error and prompt you to use the `--global` flag. | ||
- Aliases must be unique across both global and local identities. chicle will prevent you from creating an identity with an alias that already exists in either scope. | ||
- The `list` command shows both global and local identities separately for better clarity. | ||
- When switching identities, chicle clears existing SSH keys from the agent before adding the new one to ensure a clean switch. | ||
|
||
## Error Messages and Troubleshooting | ||
|
||
chicle provides informative error messages to guide you: | ||
|
||
- If you're not in a Git repository for local operations, you'll be prompted to use the `--global` flag or navigate to a Git repository. | ||
- If an alias already exists, you'll be informed and asked to choose a different alias. | ||
- If an identity is not found during switch or delete operations, you'll be prompted to use the `list` command to see available identities. | ||
|
||
For more detailed output, use the `--verbose` flag with any command. | ||
|
||
## Contributing | ||
|
||
Contributions are welcome! Please feel free to submit a Pull Request. | ||
Contributions are welcome! Please see the [CONTRIBUTING.md](CONTRIBUTING.md) file for guidelines on how to contribute to this project. | ||
|
||
## License | ||
|
||
|
Oops, something went wrong.