-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
454b1c2
commit c1f3b98
Showing
9 changed files
with
150 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
gitmirror | ||
gitmirror-init | ||
gitmirror-help | ||
gitmirror-version | ||
gitmirror-initialize | ||
gitmirror-update |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// Package cli organizes and implements a command line program. | ||
package cli | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
) | ||
|
||
const ( | ||
helpCmd = "gitmirror-help" | ||
helpVersion = "v0.1.0" | ||
helpUsage = `usage: gitmirror help <command> | ||
Display help information for the specified command | ||
The commands are: | ||
initialize|init Initialize repositories to mirror | ||
update|up Update mirrored repositories | ||
version Print version and exit | ||
` | ||
) | ||
|
||
// Help displays the help message for a command. | ||
func (app *App) Help(args []string) { | ||
if app.NoOp() { | ||
return | ||
} | ||
if len(args) != 1 { | ||
fmt.Fprintf(os.Stderr, "%s: no command given\n", helpCmd) | ||
fmt.Fprint(os.Stderr, helpUsage) | ||
app.ExitValue = exitFailure | ||
return | ||
} | ||
switch args[0] { | ||
case "init", "initialize": | ||
fmt.Fprint(os.Stdout, initUsage) | ||
case "up", "update": | ||
fmt.Fprint(os.Stdout, updateUsage) | ||
case "version": | ||
fmt.Fprint(os.Stdout, versionUsage) | ||
default: | ||
fmt.Fprint(os.Stderr, helpUsage) | ||
app.ExitValue = exitFailure | ||
} | ||
} | ||
|
||
// InitRun clones requested repos locally for mirroring. | ||
func CmdHelp(args []string) int { | ||
app := NewApp(helpCmd, helpVersion, helpUsage) | ||
app.Help(args) | ||
return app.ExitValue | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package cli | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
) | ||
|
||
const ( | ||
versionCmd = "gitmirror-version" | ||
versionVersion = "v0.1.0" | ||
versionUsage = `usage: gitmirror version | ||
Display version information about gitmirror | ||
` | ||
) | ||
|
||
// Version displays version information about gitmirror. | ||
func (app *App) Version(args []string) { | ||
if app.NoOp() { | ||
return | ||
} | ||
if len(args) != 0 { | ||
fmt.Fprintf(os.Stderr, "%s: no arguments accepted\n", versionCmd) | ||
fmt.Fprint(os.Stderr, versionUsage) | ||
app.ExitValue = exitFailure | ||
return | ||
} | ||
fmt.Fprintf(os.Stdout, "%s: %s\n", versionCmd, versionVersion) | ||
} | ||
|
||
// InitRun clones requested repos locally for mirroring. | ||
func CmdVersion(args []string) int { | ||
app := NewApp(versionCmd, versionVersion, versionUsage) | ||
app.Version(args) | ||
return app.ExitValue | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.