当前位置: 首页>>代码示例>>Golang>>正文


Golang errs.Fatal函数代码示例

本文整理汇总了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)
	}
}
开发者ID:jkotrlik,项目名称:salsaflow,代码行数:9,代码来源:main.go

示例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()
}
开发者ID:salsaflow,项目名称:salsaflow,代码行数:26,代码来源:main.go

示例3: InitOrDie

func InitOrDie() {
	if err := Init(false); err != nil {
		if errs.RootCause(err) != repo.ErrInitialised {
			errs.Fatal(err)
		}
	}
}
开发者ID:jkotrlik,项目名称:salsaflow,代码行数:7,代码来源:app.go

示例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()
	}
}
开发者ID:salsaflow,项目名称:salsaflow,代码行数:26,代码来源:command.go

示例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)
	}
}
开发者ID:salsaflow,项目名称:salsaflow,代码行数:10,代码来源:command.go

示例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)
	}
}
开发者ID:salsaflow,项目名称:salsaflow,代码行数:12,代码来源:command.go

示例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)
	}
}
开发者ID:salsaflow,项目名称:salsaflow,代码行数:14,代码来源:command.go

示例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)
	}
}
开发者ID:salsaflow,项目名称:salsaflow,代码行数:14,代码来源:command.go

示例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)
	}
}
开发者ID:salsaflow,项目名称:salsaflow,代码行数:18,代码来源:command.go

示例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")
}
开发者ID:jkotrlik,项目名称:salsaflow,代码行数:18,代码来源:command.go

示例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)
}
开发者ID:jkotrlik,项目名称:salsaflow,代码行数:30,代码来源:command.go


注:本文中的github.com/salsaflow/salsaflow/errs.Fatal函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。