Example #1
0
func runRmPort(cmd *cobra.Command, args []string) (exit int) {
	if len(args) == 0 {
		cmd.Usage()
		return 1
	}
	if len(args) != 1 {
		stderr("port remove: incorrect number of arguments")
		return 1
	}

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

	if debug {
		stderr("Removing port %q", args[0])
	}

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

	if err != nil {
		stderr("port remove: %v", err)
		return 1
	}

	return 0
}
Example #2
0
func runRmPort(cmd *cobra.Command, args []string) (exit int) {
	if len(args) == 0 {
		cmd.Usage()
		return 1
	}
	if len(args) != 1 {
		stderr("port remove: incorrect number of arguments")
		return 1
	}

	if debug {
		stderr("Removing port %q", args[0])
	}

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

	if err != nil {
		stderr("port remove: %v", err)
		return 1
	}

	return 0
}