6
0
mirror of https://github.com/grdl/git-get.git synced 2026-02-04 12:46:46 +00:00

Don't show usage on clone error

This commit is contained in:
Grzegorz Dlugoszewski
2020-05-29 10:50:52 +02:00
parent 3335c81aa4
commit b72f984512
2 changed files with 13 additions and 26 deletions

View File

@@ -2,16 +2,3 @@
`git get` - a better way to clone, organize and manage git repositories.
## Features
Show repo status:
- uncommitted changes
- untracked files
- push needed (master, branch1, branch2 etc.)
- pull needed
- upstream missing
- stashes?
- state (merging, rebasing, conflict, cherry picking etc)
- ahead/behind?
- submodules?

View File

@@ -11,9 +11,10 @@ import (
const ReposRoot = "/tmp/gitget"
var cmd = &cobra.Command{
Use: "git-get",
Use: "git-get <repo>",
Short: "git get",
RunE: Run,
Run: Run,
Args: cobra.ExactArgs(1),
Version: "0.0.0",
}
@@ -21,23 +22,22 @@ func init() {
//cmd.PersistentFlags().
}
func Run(cmd *cobra.Command, args []string) error {
func Run(cmd *cobra.Command, args []string) {
url, err := pkg.ParseURL(args[0])
if err != nil {
return err
}
exitIfError(err)
_, err = pkg.CloneRepo(url, ReposRoot, false)
return err
exitIfError(err)
}
func Execute() {
if err := cmd.Execute(); err != nil {
func main() {
err := cmd.Execute()
exitIfError(err)
}
func exitIfError(err error) {
if err != nil {
fmt.Println(err)
os.Exit(1)
}
}
func main() {
Execute()
}