Ejemplo n.º 1
0
func main() {
	kingpin.CommandLine.Help = "An example implementation of curl."
	switch kingpin.Parse() {
	case "get":
		kingpin.FatalIfError(apply("GET", (*getURL).String()), "GET failed")

	case "post":
		kingpin.FatalIfError(applyPOST(), "POST failed")
	}
}
Ejemplo n.º 2
0
func main() {
	kingpin.UsageTemplate(kingpin.CompactUsageTemplate).Version("1.0").Author("Alec Thomas")
	kingpin.CommandLine.Help = "An example implementation of curl."
	switch kingpin.Parse() {
	case "get url":
		kingpin.FatalIfError(apply("GET", (*getURLURL).String()), "GET failed")

	case "post":
		kingpin.FatalIfError(applyPOST(), "POST failed")
	}
}
Ejemplo n.º 3
0
func main() {
	kingpin.UsageTemplate(kingpin.DefaultUsageTemplate).Author("Cathal Garvey")
	//kingpin.CommandLine.Help = "miniLock-cli: The miniLock encryption system for terminal/scripted use."
	switch kingpin.Parse() {
	case "encrypt":
		kingpin.FatalIfError(encryptFile(), "Failed to encrypt..")
	case "decrypt":
		{
			kingpin.FatalIfError(decryptFile(), "Failed to decrypt..")
		}
	default:
		{
			fmt.Println("No subcommand provided..")
		}
	}
	if userKey != nil {
		userKey.Wipe()
	}
}
Ejemplo n.º 4
0
func (l *LiveBuilder) updateTargetMonitors(target Target, log *Logger, last glob.Set) {
	id := target.ID()
	inputs, err := target.Inputs()
	kingpin.FatalIfError(err, "failed to acquire inputs for %s", target)
	next := glob.SetFromStrings(inputs...)
	unmonitor := last.Difference(next).Slice()
	if len(unmonitor) > 0 {
		log.Debugf("Unmonitoring: %s", strings.Join(unmonitor.Strings(), ", "))
		l.monitor.Unmonitor(id, unmonitor)
	}
	monitor := next.Difference(last).Slice()
	last = next
	if len(monitor) != 0 {
		log.Debugf("Monitoring: %s", strings.Join(monitor.Strings(), ", "))
		l.monitor.Monitor(id, monitor, l.debounce(func(paths []string) {
			err = target.Build(LiveBuild, paths)
			if err != nil {
				log.Printf("build failed: %s", err)
			}
			l.updateTargetMonitors(target, log, last)
		}))
	}
}