Exemple #1
0
/**
 * Runner for global commands
 * Global commands are searched locally from $HOME/.unify.yml
 *
 */
func Global(args []string) {
	if len(args) == 1 {

		task := args[0]
		homeDir := os.Getenv("HOME")
		globalFile := homeDir + "/.unify.yml"
		if util.FileExists(globalFile) {
			tasks, _ := FromFile(globalFile)
			result := ExecuteTasks(task, tasks, []string{})
			if !result {
				fmt.Println("Could not find task " + task)
			}
			return
		}
		fmt.Println("Please create a global unify file at ~/.unify.yml")
	}
}
Exemple #2
0
// Checks that a unify.yml file actually exists
// Abort if we can't find one
func PreCheck() {
	if !util.FileExists("unify.yml") {
		fmt.Println("Could not find unify.yml in current directory")
		os.Exit(0)
	}
}