Skip to content

Commit 054f8df

Browse files
authored
docs: Add CLI commands to README (#7)
* feat: Add git-scope issue command to open GitHub issues page * docs: Add CLI commands to README
1 parent 91509ed commit 054f8df

File tree

4 files changed

+54
-16
lines changed

4 files changed

+54
-16
lines changed

README.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,17 @@ Simply run it in any directory containing your projects:
4747
```bash
4848
git-scope
4949
```
50-
#### Help
50+
51+
#### Commands
5152
```bash
52-
git-scope -h
53+
git-scope # Launch TUI dashboard
54+
git-scope init # Create config file interactively
55+
git-scope scan # Scan and print repos (JSON)
56+
git-scope scan-all # Full system scan from home directory
57+
git-scope issue # Open GitHub issues page in browser
58+
git-scope -h # Show help
5359
```
60+
5461
*By default, it recursively scans the current directory. You can configure permanent root paths later.*
5562

5663
-----

cmd/git-scope/main.go

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"path/filepath"
1010
"strings"
1111

12+
"github.com/Bharath-code/git-scope/internal/browser"
1213
"github.com/Bharath-code/git-scope/internal/config"
1314
"github.com/Bharath-code/git-scope/internal/scan"
1415
"github.com/Bharath-code/git-scope/internal/tui"
@@ -27,6 +28,7 @@ Commands:
2728
scan Scan and print repos (JSON)
2829
scan-all Full system scan from home directory (with stats)
2930
init Create config file interactively
31+
issue Open git-scope GitHub issues page in browser
3032
help Show this help
3133
3234
Examples:
@@ -35,6 +37,7 @@ Examples:
3537
git-scope scan . # Scan current directory (JSON)
3638
git-scope scan-all # Find ALL repos on your system
3739
git-scope init # Setup config interactively
40+
git-scope issue # Open GitHub issues page
3841
3942
Flags:
4043
`, version)
@@ -61,7 +64,7 @@ func main() {
6164
// Parse command and directories
6265
if len(args) >= 1 {
6366
switch args[0] {
64-
case "scan", "tui", "help", "init", "scan-all", "-h", "--help", "-v", "--version":
67+
case "scan", "tui", "help", "init", "scan-all", "issue", "-h", "--help", "-v", "--version":
6568
cmd = args[0]
6669
dirs = args[1:]
6770
default:
@@ -89,6 +92,12 @@ func main() {
8992
return
9093
}
9194

95+
// Handle issue command
96+
if cmd == "issue" {
97+
runIssue()
98+
return
99+
}
100+
92101
// Load configuration
93102
cfg, err := config.Load(*configPath)
94103
if err != nil {
@@ -293,6 +302,16 @@ func runInit() {
293302
fmt.Println("\n🚀 Run 'git-scope' to launch the dashboard!")
294303
}
295304

305+
// runIssue opens the git-scope GitHub issues page in the default browser
306+
func runIssue() {
307+
issuesURL := "https://github.com/Bharath-code/git-scope/issues"
308+
if err := browser.Open(issuesURL); err != nil {
309+
fmt.Fprintf(os.Stderr, "Failed to open browser: %v\n", err)
310+
fmt.Fprintf(os.Stderr, "You can visit the issues page manually at: %s\n", issuesURL)
311+
os.Exit(1)
312+
}
313+
}
314+
296315
// runScanAll performs a full system scan starting from home directory
297316
func runScanAll() {
298317
home, err := os.UserHomeDir()

internal/browser/browser.go

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package browser
2+
3+
import (
4+
"fmt"
5+
"os/exec"
6+
"runtime"
7+
)
8+
9+
// Open opens a URL in the system default browser
10+
func Open(url string) error {
11+
var cmd *exec.Cmd
12+
switch runtime.GOOS {
13+
case "darwin":
14+
cmd = exec.Command("open", url)
15+
case "linux":
16+
cmd = exec.Command("xdg-open", url)
17+
case "windows":
18+
cmd = exec.Command("rundll32", "url.dll,FileProtocolHandler", url)
19+
default:
20+
return fmt.Errorf("unsupported operating system: %s", runtime.GOOS)
21+
}
22+
return cmd.Run()
23+
}

internal/tui/update.go

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ package tui
33
import (
44
"fmt"
55
"os/exec"
6-
"runtime"
76

7+
"github.com/Bharath-code/git-scope/internal/browser"
88
"github.com/Bharath-code/git-scope/internal/model"
99
"github.com/Bharath-code/git-scope/internal/nudge"
1010
"github.com/Bharath-code/git-scope/internal/scan"
@@ -506,18 +506,7 @@ func scanWorkspaceCmd(workspacePath string, ignore []string) tea.Cmd {
506506
// openBrowserCmd opens a URL in the default browser
507507
func openBrowserCmd(url string) tea.Cmd {
508508
return func() tea.Msg {
509-
var cmd *exec.Cmd
510-
switch runtime.GOOS {
511-
case "darwin":
512-
cmd = exec.Command("open", url)
513-
case "linux":
514-
cmd = exec.Command("xdg-open", url)
515-
case "windows":
516-
cmd = exec.Command("rundll32", "url.dll,FileProtocolHandler", url)
517-
default:
518-
return nil
519-
}
520-
_ = cmd.Run()
509+
_ = browser.Open(url)
521510
return nil
522511
}
523512
}

0 commit comments

Comments
 (0)