feat: optional -R when in a git repo
This commit is contained in:
parent
a2d3858462
commit
aa2be8587a
4 changed files with 258 additions and 16 deletions
51
README.md
51
README.md
|
|
@ -8,6 +8,7 @@
|
|||
- Pull request management (create, list, view, merge)
|
||||
- Issue tracking (create, list, view, comment, close)
|
||||
- Repository operations (view, list, clone, fork)
|
||||
- Automatic repository detection from git context
|
||||
- Secure authentication with personal access tokens
|
||||
- AI coding agent friendly
|
||||
|
||||
|
|
@ -56,39 +57,68 @@ fgj auth status
|
|||
|
||||
## Usage
|
||||
|
||||
### Repository Detection
|
||||
|
||||
`fgj` automatically detects the repository from your git context, similar to `gh`:
|
||||
|
||||
```bash
|
||||
# When inside a git repository, no -R flag needed!
|
||||
cd /path/to/your/repo
|
||||
fgj pr list # Automatically uses current repo
|
||||
fgj issue list # Automatically uses current repo
|
||||
fgj pr view 123 # Automatically uses current repo
|
||||
|
||||
# Or explicitly specify a repository with -R
|
||||
fgj pr list -R owner/repo
|
||||
```
|
||||
|
||||
The tool reads `.git/config` to find the origin remote and extract the owner/repo information. If you're not in a git repository, you'll need to use the `-R` flag.
|
||||
|
||||
### Pull Requests
|
||||
|
||||
```bash
|
||||
# List pull requests
|
||||
# List pull requests (auto-detects repo from git)
|
||||
fgj pr list
|
||||
|
||||
# Or specify explicitly
|
||||
fgj pr list -R owner/repo
|
||||
|
||||
# Filter by state
|
||||
fgj pr list --state closed
|
||||
|
||||
# View a specific pull request
|
||||
fgj pr view 123 -R owner/repo
|
||||
fgj pr view 123
|
||||
|
||||
# Create a pull request
|
||||
fgj pr create -R owner/repo -t "PR Title" -b "PR Description" -H feature-branch -B main
|
||||
fgj pr create -t "PR Title" -b "PR Description" -H feature-branch -B main
|
||||
|
||||
# Merge a pull request
|
||||
fgj pr merge 123 -R owner/repo --merge-method squash
|
||||
fgj pr merge 123 --merge-method squash
|
||||
```
|
||||
|
||||
### Issues
|
||||
|
||||
```bash
|
||||
# List issues
|
||||
# List issues (auto-detects repo from git)
|
||||
fgj issue list
|
||||
|
||||
# Or specify explicitly
|
||||
fgj issue list -R owner/repo
|
||||
|
||||
# Filter by state
|
||||
fgj issue list --state all
|
||||
|
||||
# View an issue
|
||||
fgj issue view 456 -R owner/repo
|
||||
fgj issue view 456
|
||||
|
||||
# Create an issue
|
||||
fgj issue create -R owner/repo -t "Issue Title" -b "Issue Description"
|
||||
fgj issue create -t "Issue Title" -b "Issue Description"
|
||||
|
||||
# Comment on an issue
|
||||
fgj issue comment 456 -R owner/repo -b "My comment"
|
||||
fgj issue comment 456 -b "My comment"
|
||||
|
||||
# Close an issue
|
||||
fgj issue close 456 -R owner/repo
|
||||
fgj issue close 456
|
||||
```
|
||||
|
||||
### Repositories
|
||||
|
|
@ -194,7 +224,8 @@ fgj/
|
|||
│ └── repo.go # Repository commands
|
||||
├── internal/
|
||||
│ ├── api/ # API client wrapper
|
||||
│ └── config/ # Configuration management
|
||||
│ ├── config/ # Configuration management
|
||||
│ └── git/ # Git repository detection
|
||||
├── main.go # Entry point
|
||||
└── go.mod # Dependencies
|
||||
```
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue