Skip to content

Commit 2c8e1c7

Browse files
committed
cli: accept --doc-id and --github-repo as required cli flags
1 parent 60387c5 commit 2c8e1c7

1 file changed

Lines changed: 35 additions & 7 deletions

File tree

cmd/bauer/main.go

Lines changed: 35 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,39 @@ import (
55
"bauer/internal/orchestrator"
66
"bauer/internal/workflow"
77
"context"
8+
"flag"
89
"fmt"
910
"os"
11+
"strings"
1012
)
1113

1214
func main() {
15+
// Parse CLI flags
16+
githubRepo := flag.String("github-repo", "", "GitHub repository (owner/repo or HTTPS URL)")
17+
docID := flag.String("doc-id", "", "Google Doc ID")
18+
credentialsPath := flag.String("credentials", "bau-test-creds.json", "Path to service account credentials JSON")
19+
localRepoPath := flag.String("local-repo-path", "/tmp/ubuntu.com", "Local path for cloned repository")
20+
dryRun := flag.Bool("dry-run", false, "Perform a dry run without creating PR")
21+
outputDir := flag.String("output-dir", "bauer-output", "Output directory for Bauer results")
22+
branchPrefix := flag.String("branch-prefix", "bauer", "Branch naming prefix")
23+
24+
flag.Parse()
25+
26+
// Validate required flags
27+
if *githubRepo == "" {
28+
fmt.Fprintf(os.Stderr, "ERROR: --github-repo is required\n")
29+
os.Exit(1)
30+
}
31+
if *docID == "" {
32+
fmt.Fprintf(os.Stderr, "ERROR: --doc-id is required\n")
33+
os.Exit(1)
34+
}
35+
36+
fmt.Println(strings.Repeat("=", 80))
37+
fmt.Println("Bauer - A tool to automate BAU tasks")
38+
fmt.Println(strings.Repeat("=", 80))
39+
fmt.Println()
40+
1341
// Create workflow input from CLI flags/config
1442
ghToken, err := github.GetGitHubToken()
1543
if err != nil {
@@ -18,14 +46,14 @@ func main() {
1846
}
1947

2048
workflowInput := workflow.WorkflowInput{
21-
GitHubRepo: "canonical/ubuntu.com",
49+
GitHubRepo: *githubRepo,
2250
GitHubToken: ghToken,
23-
BranchPrefix: "bauer",
24-
DocID: "16AMRADqnW2Ssi1zYL68LqBB3__VIkL9Jegv-ZubWTGg",
25-
Credentials: "bau-test-creds.json",
26-
LocalRepoPath: "/tmp/ubuntu.com",
27-
DryRun: false,
28-
OutputDir: "bauer-output",
51+
BranchPrefix: *branchPrefix,
52+
DocID: *docID,
53+
Credentials: *credentialsPath,
54+
LocalRepoPath: *localRepoPath,
55+
DryRun: *dryRun,
56+
OutputDir: *outputDir,
2957
}
3058

3159
orch := orchestrator.NewOrchestrator()

0 commit comments

Comments
 (0)