Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,17 @@ Simply run it in any directory containing your projects:
```bash
git-scope
```
#### Help

#### Commands
```bash
git-scope -h
git-scope # Launch TUI dashboard
git-scope init # Create config file interactively
git-scope scan # Scan and print repos (JSON)
git-scope scan-all # Full system scan from home directory
git-scope issue # Open GitHub issues page in browser
git-scope -h # Show help
```

*By default, it recursively scans the current directory. You can configure permanent root paths later.*

-----
Expand Down
21 changes: 20 additions & 1 deletion cmd/git-scope/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"path/filepath"
"strings"

"github.com/Bharath-code/git-scope/internal/browser"
"github.com/Bharath-code/git-scope/internal/config"
"github.com/Bharath-code/git-scope/internal/scan"
"github.com/Bharath-code/git-scope/internal/tui"
Expand All @@ -27,6 +28,7 @@ Commands:
scan Scan and print repos (JSON)
scan-all Full system scan from home directory (with stats)
init Create config file interactively
issue Open git-scope GitHub issues page in browser
help Show this help

Examples:
Expand All @@ -35,6 +37,7 @@ Examples:
git-scope scan . # Scan current directory (JSON)
git-scope scan-all # Find ALL repos on your system
git-scope init # Setup config interactively
git-scope issue # Open GitHub issues page

Flags:
`, version)
Expand All @@ -61,7 +64,7 @@ func main() {
// Parse command and directories
if len(args) >= 1 {
switch args[0] {
case "scan", "tui", "help", "init", "scan-all", "-h", "--help", "-v", "--version":
case "scan", "tui", "help", "init", "scan-all", "issue", "-h", "--help", "-v", "--version":
cmd = args[0]
dirs = args[1:]
default:
Expand Down Expand Up @@ -89,6 +92,12 @@ func main() {
return
}

// Handle issue command
if cmd == "issue" {
runIssue()
return
}

// Load configuration
cfg, err := config.Load(*configPath)
if err != nil {
Expand Down Expand Up @@ -293,6 +302,16 @@ func runInit() {
fmt.Println("\n🚀 Run 'git-scope' to launch the dashboard!")
}

// runIssue opens the git-scope GitHub issues page in the default browser
func runIssue() {
issuesURL := "https://github.com/Bharath-code/git-scope/issues"
if err := browser.Open(issuesURL); err != nil {
fmt.Fprintf(os.Stderr, "Failed to open browser: %v\n", err)
fmt.Fprintf(os.Stderr, "You can visit the issues page manually at: %s\n", issuesURL)
os.Exit(1)
}
}

// runScanAll performs a full system scan starting from home directory
func runScanAll() {
home, err := os.UserHomeDir()
Expand Down
23 changes: 23 additions & 0 deletions internal/browser/browser.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package browser

import (
"fmt"
"os/exec"
"runtime"
)

// Open opens a URL in the system default browser
func Open(url string) error {
var cmd *exec.Cmd
switch runtime.GOOS {
case "darwin":
cmd = exec.Command("open", url)
case "linux":
cmd = exec.Command("xdg-open", url)
case "windows":
cmd = exec.Command("rundll32", "url.dll,FileProtocolHandler", url)
default:
return fmt.Errorf("unsupported operating system: %s", runtime.GOOS)
}
return cmd.Run()
}
15 changes: 2 additions & 13 deletions internal/tui/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package tui
import (
"fmt"
"os/exec"
"runtime"

"github.com/Bharath-code/git-scope/internal/browser"
"github.com/Bharath-code/git-scope/internal/model"
"github.com/Bharath-code/git-scope/internal/nudge"
"github.com/Bharath-code/git-scope/internal/scan"
Expand Down Expand Up @@ -506,18 +506,7 @@ func scanWorkspaceCmd(workspacePath string, ignore []string) tea.Cmd {
// openBrowserCmd opens a URL in the default browser
func openBrowserCmd(url string) tea.Cmd {
return func() tea.Msg {
var cmd *exec.Cmd
switch runtime.GOOS {
case "darwin":
cmd = exec.Command("open", url)
case "linux":
cmd = exec.Command("xdg-open", url)
case "windows":
cmd = exec.Command("rundll32", "url.dll,FileProtocolHandler", url)
default:
return nil
}
_ = cmd.Run()
_ = browser.Open(url)
return nil
}
}