Exemple #1
0
func showUsage() {
	info := usage.NewInfo("", "log-file")

	info.AddOption(ARG_NO_COLOR, "Disable colors in output")
	info.AddOption(ARG_DATE_FROM, "Time range start", "date")
	info.AddOption(ARG_DATE_TO, "Time range end", "date")
	info.AddOption(ARG_HELP, "Show this help message")
	info.AddOption(ARG_VER, "Show version")

	info.AddExample("/path/to/file.log", "Read log file")
	info.AddExample("file.log", "Try to find file.log in mockka logs directory")
	info.AddExample("file", "Try to find file.log in mockka logs directory")

	info.AddExample(
		"-f 2016/01/02 -t 2016/01/05 /path/to/file.log",
		"Read file and show only records between 2016/01/02 and 2016/01/05",
	)

	info.AddExample(
		"-f \"2016/01/02 12:00\" /path/to/file.log",
		"Read file and show only records between 2016/01/02 12:00 and current moment",
	)

	info.Render()
}
Exemple #2
0
func showUsage() {
	info := usage.NewInfo("")

	info.AddCommand(COMMAND_RUN, "Run mockka server")
	info.AddCommand(COMMAND_CHECK, "Check rule for problems", "mock-file")
	info.AddCommand(COMMAND_MAKE, "Create mock file from template", "mock-name")
	info.AddCommand(COMMAND_LIST, "Show list of exist rules", "service-name")

	info.AddOption(ARG_CONFIG, "Path to config file", "file")
	info.AddOption(ARG_PORT, "Overwrite port", fmt.Sprintf("%d-%d", MIN_PORT, MAX_PORT))
	info.AddOption(ARG_DAEMON, "Run server in daemon mode")
	info.AddOption(ARG_NO_COLOR, "Disable colors in output")
	info.AddOption(ARG_HELP, "Show this help message")
	info.AddOption(ARG_VER, "Show version")

	info.AddExample(
		"-c /path/to/mockka.conf run",
		"Run mockka server and use config /path/to/mockka.conf",
	)

	info.AddExample(
		"make service1/test1",
		"Create file test1.mock for service service1.",
	)

	info.AddExample(
		"check service1/test1",
		"Check rule file test1.mock for service service1",
	)

	info.AddExample(
		"check service1/test1",
		"Check all rules of service service1",
	)

	info.AddExample("list", "List all rules")
	info.AddExample("list service1", "List service1 rules")

	info.Render()
}