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:
13
README.md
13
README.md
@@ -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?
|
||||
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user