Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Huge refactoring #63

Merged
merged 16 commits into from
Jan 22, 2025
Prev Previous commit
Next Next commit
Add fetch comin command
  • Loading branch information
nlewo committed Jan 14, 2025
commit 7bca37cc13bd448412c27a452f9323a174a55b0d
29 changes: 29 additions & 0 deletions cmd/fetcher.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package cmd

import (
"net/http"
"time"

"github.com/spf13/cobra"
)

var fetchCmd = &cobra.Command{
Use: "fetch",
Short: "Trigger a fetch of all Git remotes",
Args: cobra.MinimumNArgs(0),
Run: func(cmd *cobra.Command, args []string) {
url := "http://localhost:4242/api/fetcher/fetch"
client := http.Client{
Timeout: time.Second * 2,
}
req, err := http.NewRequest(http.MethodPost, url, nil)
if err != nil {
return
}
client.Do(req)
},
}

func init() {
rootCmd.AddCommand(fetchCmd)
}
2 changes: 1 addition & 1 deletion cmd/status.go
Original file line number Diff line number Diff line change
@@ -66,7 +66,7 @@ func printCommit(selectedRemoteName, selectedBranchName, selectedCommitId, selec
}

func getStatus() (status manager.State, err error) {
url := "http://localhost:4242/status"
url := "http://localhost:4242/api/status"
client := http.Client{
Timeout: time.Second * 2,
}