Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions Sources/Komondor/Commands/runner.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,17 @@ public func runner(logger _: Logger, args: [String]) throws {
try commands.forEach { command in
print("> \(command)")
// Simple is fine for now
try shellOut(to: command)

print(try shellOut(to: command))
// Ideal:
// Store STDOUT and STDERR, and only show it if it fails
// Show a stepper like system of all commands
}
} catch let error as ShellOutError {
print(error.message)
print(error.output)
exit(error.terminationStatus)
} catch {
guard let error = error as? ShellOutError else { return }
print(error.message) // Prints STDERR
print(error.output) // Prints STDOUT
print(error)
exit(1)
}
}
19 changes: 10 additions & 9 deletions Sources/Komondor/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,7 @@ logger.debug("Setting up .git-hooks for Komondor (v\(KomondorVersion))")

let cliLength = ProcessInfo.processInfo.arguments.count

if cliLength > 1 {
let task = CommandLine.arguments[1]
if task == "install" {
try install(logger: logger)
} else if task == "run" {
let runnerArgs = Array(CommandLine.arguments.dropFirst().dropFirst())
try runner(logger: logger, args: runnerArgs)
}
} else {
guard cliLength > 1 else {
print("""
Welcome to Komondor, it has 2 commands:

Expand All @@ -27,4 +19,13 @@ if cliLength > 1 {

Docs are available at: https://github.com/orta/Komondor
""")
exit(0)
}

let task = CommandLine.arguments[1]
if task == "install" {
try install(logger: logger)
} else if task == "run" {
let runnerArgs = Array(CommandLine.arguments.dropFirst().dropFirst())
try runner(logger: logger, args: runnerArgs)
}