<commit_before>/*
Orchid is an application for running scripts locally and remotely for testing
and deployment. The application consists of a command line interface and a CI
server.
*/

package main

import (
	"flag"
	"fmt"
	"os"
)

/*
Entry point for the Orchid command line interface
*/
func main() {
	// Make sure some command is given
	if len(os.Args) < 2 {
		printUsage()
		return
	}

	// Handle flags and arguments
	var path string
	flag.StringVar(&path, "-p", "orchid", "Specify the path to the config directory")
	flag.Parse()
	var args = flag.Args()

	actions := Actions{path}

	// Run job
	if args[0] == "run" {
		if len(args) != 2 {
			printUsage()
			return
		}

		jobId := args[1]
		actions.RunJob(jobId)
	}

	// List
	if args[0] == "list" {
		if len(args) != 2 {
			printUsage()
			return
		}

		if args[1] == "jobs" {
			// List jobs
			actions.ListJobs()
		} else if args[1] == "machines" {
			// List machines
			actions.ListMachines()
		} else if args[1] == "scripts" {
			// List scripts
			actions.ListScripts()
		} else if args[1] == "logs" {
			// List logs
			actions.ListLogs()
		} else {
			printUsage()
		}
	}

	// Get log output
	if args[0] == "logs" {
		if len(args) != 2 {
			printUsage()
			return
		}

		logId := args[1]
		actions.GetLogOutput(logId)
	}

	// SSH into a given machine
	if args[0] == "ssh" {
		if len(args) != 2 {
			printUsage()
			return
		}

		machineId := args[1]
		actions.SSH(machineId)
	}
}

/*
Prints a help message, explaining how to use the application
*/
func printUsage() {
	fmt.Println("Usage:")
	fmt.Println("- list jobs\t// List all configured jobs")
	fmt.Println("- list machines\t// List all configured machines")
	fmt.Println("- list scripts\t// List all configured scripts")
	fmt.Println("- list logs\t// List all stored logs")
	fmt.Println("- run <job id>\t// Run the job with the given id")
	fmt.Println("- logs <log id>\t// Tail the log with the given id")
	fmt.Println("- ssh <machine id>\t// SSH into the machine with the given id")
}
<commit_msg>Create logs dir if not exists<commit_after>/*
Orchid is an application for running scripts locally and remotely for testing
and deployment. The application consists of a command line interface and a CI
server.
*/

package main

import (
	"flag"
	"fmt"
	"os"
)

/*
Entry point for the Orchid command line interface
*/
func main() {
	// Make sure some command is given
	if len(os.Args) < 2 {
		printUsage()
		return
	}

	// Handle flags and arguments
	var path string
	flag.StringVar(&path, "-p", "orchid", "Specify the path to the config directory")
	flag.Parse()
	var args = flag.Args()

	actions := Actions{path}

	// Create logs dir if it does not exist
	os.Mkdir("orchid/logs", 0744)

	// Run job
	if args[0] == "run" {
		if len(args) != 2 {
			printUsage()
			return
		}

		jobId := args[1]
		actions.RunJob(jobId)
	}

	// List
	if args[0] == "list" {
		if len(args) != 2 {
			printUsage()
			return
		}

		if args[1] == "jobs" {
			// List jobs
			actions.ListJobs()
		} else if args[1] == "machines" {
			// List machines
			actions.ListMachines()
		} else if args[1] == "scripts" {
			// List scripts
			actions.ListScripts()
		} else if args[1] == "logs" {
			// List logs
			actions.ListLogs()
		} else {
			printUsage()
		}
	}

	// Get log output
	if args[0] == "logs" {
		if len(args) != 2 {
			printUsage()
			return
		}

		logId := args[1]
		actions.GetLogOutput(logId)
	}

	// SSH into a given machine
	if args[0] == "ssh" {
		if len(args) != 2 {
			printUsage()
			return
		}

		machineId := args[1]
		actions.SSH(machineId)
	}
}

/*
Prints a help message, explaining how to use the application
*/
func printUsage() {
	fmt.Println("Usage:")
	fmt.Println("- list jobs\t// List all configured jobs")
	fmt.Println("- list machines\t// List all configured machines")
	fmt.Println("- list scripts\t// List all configured scripts")
	fmt.Println("- list logs\t// List all stored logs")
	fmt.Println("- run <job id>\t// Run the job with the given id")
	fmt.Println("- logs <log id>\t// Tail the log with the given id")
	fmt.Println("- ssh <machine id>\t// SSH into the machine with the given id")
}

{'fraction_non_alphanumeric': 0.1452825612418142, 'fraction_numerical': 0.00873150618481688, 'mean_word_length': 2.8979206049149338, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5140628', 'n_tokens_mistral': 1608, 'n_tokens_neox': 1446, 'n_words': 481}