本文整理汇总了Golang中github.com/salsaflow/salsaflow/errs.Fatal函数的典型用法代码示例。如果您正苦于以下问题:Golang Fatal函数的具体用法?Golang Fatal怎么用?Golang Fatal使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Fatal函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: main
func main() {
// Register the magical -salsaflow.version flag.
hooks.IdentifyYourself()
// Run the hook logic itself.
if err := hook(); err != nil {
errs.Fatal(err)
}
}
示例2: main
func main() {
// Set up the identification command line flag.
hooks.IdentifyYourself()
// Tell the user what is happening.
fmt.Println("---> Running SalsaFlow pre-push hook")
// The hook is always invoked as `pre-push <remote-name> <push-url>`.
if len(os.Args) != 3 {
fmt.Fprintf(os.Stderr, "Usage: %v <remote-name> <push-url>\n", os.Args[0])
errs.Fatal(fmt.Errorf("invalid arguments: %#v\n", os.Args[1:]))
}
// Run the main function.
if err := run(os.Args[1], os.Args[2]); err != nil {
if err != prompt.ErrCanceled {
fmt.Println()
errs.Log(err)
}
asciiart.PrintGrimReaper("PUSH ABORTED")
os.Exit(1)
}
// Insert an empty line before git push output.
fmt.Println()
}
示例3: InitOrDie
func InitOrDie() {
if err := Init(false); err != nil {
if errs.RootCause(err) != repo.ErrInitialised {
errs.Fatal(err)
}
}
}
示例4: run
func run(cmd *gocli.Command, args []string) {
if len(args) != 0 {
cmd.Usage()
os.Exit(2)
}
upgraded, err := pkg.Upgrade(&pkg.InstallOptions{
GitHubOwner: flagOwner,
GitHubRepo: flagRepo,
})
if err != nil {
if err == pkg.ErrAborted {
fmt.Println("\nYour wish is my command, exiting now!")
return
}
errs.Fatal(err)
}
if upgraded {
log.Log("SalsaFlow was upgraded successfully")
} else {
log.Log("SalsaFlow is up to date")
asciiart.PrintThumbsUp()
fmt.Println()
}
}
示例5: run
func run(cmd *gocli.Command, args []string) {
if len(args) != 1 {
cmd.Usage()
os.Exit(2)
}
if err := runMain(args[0]); err != nil {
errs.Fatal(err)
}
}
示例6: run
func run(cmd *gocli.Command, args []string) {
if len(args) != 0 {
cmd.Usage()
os.Exit(2)
}
app.InitOrDie()
if err := runMain(); err != nil {
errs.Fatal(err)
}
}
示例7: run
func run(cmd *gocli.Command, args []string) {
if len(args) == 0 {
cmd.Usage()
os.Exit(2)
}
app.InitOrDie()
defer prompt.RecoverCancel()
if err := runMain(args); err != nil {
errs.Fatal(err)
}
}
示例8: run
func run(cmd *gocli.Command, args []string) {
if len(args) != 0 {
cmd.Usage()
os.Exit(2)
}
if err := app.Init(flagForce); err != nil {
if errs.RootCause(err) == repo.ErrInitialised {
log.Log("The repository has been already initialised")
return
}
errs.Fatal(err)
}
}
示例9: run
func run(cmd *gocli.Command, args []string) {
app.InitOrDie()
defer prompt.RecoverCancel()
var err error
switch {
case len(args) != 0:
err = postRevisions(args...)
case flagParent != "":
err = postBranch(flagParent)
default:
err = postTip()
}
if err != nil {
errs.Fatal(err)
}
}
示例10: run
func run(cmd *gocli.Command, args []string) {
if len(args) != 0 {
cmd.Usage()
os.Exit(2)
}
app.InitOrDie()
if err := pkg.Upgrade(&pkg.InstallOptions{flagOwner, flagRepo}); err != nil {
if err == pkg.ErrAborted {
fmt.Println("\nYour wish is my command, exiting now!")
return
}
errs.Fatal(err)
}
log.Log("SalsaFlow was upgraded successfully")
}
示例11: init
// Other
"gopkg.in/tchap/gocli.v2"
)
var Command = &gocli.Command{
UsageLine: "version",
Short: "various version-related actions",
Long: `
Print SalsaFlow version and exit. No more, no less.
There are also some cool subcommands available. Check them out.
`,
Action: func(cmd *gocli.Command, args []string) {
if len(args) != 0 {
cmd.Usage()
os.Exit(2)
}
ver, err := version.Get()
if err != nil {
errs.Fatal(err)
}
fmt.Println(ver)
},
}
func init() {
Command.MustRegisterSubcommand(bumpCmd.Command)
}