mirror of
https://github.com/grdl/git-get.git
synced 2026-02-12 13:06:20 +00:00
Don't show usage on clone error
This commit is contained in:
13
README.md
13
README.md
@@ -2,16 +2,3 @@
|
|||||||
|
|
||||||
`git get` - a better way to clone, organize and manage git repositories.
|
`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?
|
|
||||||
|
|
||||||
|
|||||||
@@ -11,9 +11,10 @@ import (
|
|||||||
const ReposRoot = "/tmp/gitget"
|
const ReposRoot = "/tmp/gitget"
|
||||||
|
|
||||||
var cmd = &cobra.Command{
|
var cmd = &cobra.Command{
|
||||||
Use: "git-get",
|
Use: "git-get <repo>",
|
||||||
Short: "git get",
|
Short: "git get",
|
||||||
RunE: Run,
|
Run: Run,
|
||||||
|
Args: cobra.ExactArgs(1),
|
||||||
Version: "0.0.0",
|
Version: "0.0.0",
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -21,23 +22,22 @@ func init() {
|
|||||||
//cmd.PersistentFlags().
|
//cmd.PersistentFlags().
|
||||||
}
|
}
|
||||||
|
|
||||||
func Run(cmd *cobra.Command, args []string) error {
|
func Run(cmd *cobra.Command, args []string) {
|
||||||
url, err := pkg.ParseURL(args[0])
|
url, err := pkg.ParseURL(args[0])
|
||||||
if err != nil {
|
exitIfError(err)
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
_, err = pkg.CloneRepo(url, ReposRoot, false)
|
_, err = pkg.CloneRepo(url, ReposRoot, false)
|
||||||
return err
|
exitIfError(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
func Execute() {
|
func main() {
|
||||||
if err := cmd.Execute(); err != nil {
|
err := cmd.Execute()
|
||||||
|
exitIfError(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
func exitIfError(err error) {
|
||||||
|
if err != nil {
|
||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
|
||||||
Execute()
|
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user