예제 #1
0
파일: set-group.go 프로젝트: apcera/acbuild
func runSetGroup(cmd *cobra.Command, args []string) (exit int) {
	if len(args) == 0 {
		cmd.Usage()
		return 1
	}
	if len(args) != 1 {
		stderr("set-group: incorrect number of arguments")
		return 1
	}

	lockfile, err := getLock()
	if err != nil {
		stderr("set-group: %v", err)
		return 1
	}
	defer func() {
		if err := releaseLock(lockfile); err != nil {
			stderr("set-group: %v", err)
			exit = 1
		}
	}()

	if debug {
		stderr("Setting group to %s", args[0])
	}

	err = lib.SetGroup(tmpacipath(), args[0])

	if err != nil {
		stderr("set-group: %v", err)
		return 1
	}

	return 0
}
예제 #2
0
func runSetGroup(cmd *cobra.Command, args []string) (exit int) {
	if len(args) == 0 {
		cmd.Usage()
		return 1
	}
	if len(args) != 1 {
		stderr("set-group: incorrect number of arguments")
		return 1
	}

	if debug {
		stderr("Setting group to %s", args[0])
	}

	err := lib.SetGroup(tmpacipath(), args[0])

	if err != nil {
		stderr("set-group: %v", err)
		return 1
	}

	return 0
}