diff --git a/.gitignore b/.gitignore index 02c0875..3982ed7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,6 @@ +.overlook .DS_Store /.build +/Tests /Packages /*.xcodeproj diff --git a/Sources/overlook/commands/init.swift b/Sources/overlook/commands/init.swift index e346b7f..000de01 100644 --- a/Sources/overlook/commands/init.swift +++ b/Sources/overlook/commands/init.swift @@ -6,15 +6,15 @@ // // -import Foundation -import SwiftCLI +import Foundation +import SwiftCLI import PathKit import Rainbow public class InitCommand : Command { public let name = "init" public let signature = "" - public let shortDescription = "Prints the current version of Overlook" + public let shortDescription = "Creates a new .overlook file in the current directory." public func execute(arguments: CommandArguments) throws { let data = try JSONSerialization.data(withJSONObject: Overlook.dotTemplate, options: .prettyPrinted) diff --git a/Sources/overlook/overlook.swift b/Sources/overlook/overlook.swift index 0651e08..31a9bb8 100644 --- a/Sources/overlook/overlook.swift +++ b/Sources/overlook/overlook.swift @@ -6,18 +6,18 @@ // // -import Foundation -import SwiftCLI -import PathKit +import Foundation +import SwiftCLI +import PathKit import Rainbow import config import env public class Overlook { static let name = "overlook" - static let version = "0.1.0" + static let version = "0.1.1" static let desc = "File monitoring tool that excutes on change. Used anywhere." - + static let dotTemplate:[String:Any] = [ "env" : ["example" : "variable"], "verbose" : true, @@ -40,17 +40,17 @@ public class Overlook { initCommand, ] } - + public init() { CLI.setup(name: Overlook.name, version: Overlook.version, description: Overlook.desc) - + setupRouter() setupCommands() setupAliases() - } + } private func setupRouter() { - CLI.router = self.router + CLI.router = self.router } private func setupCommands() { @@ -68,29 +68,29 @@ public class Overlook { CLI.alias(from: "-v", to: "version") CLI.alias(from: "--version", to: "version") - + CLI.alias(from: "-i", to: "init") CLI.alias(from: "--init", to: "init") - + CLI.alias(from: "-w", to: "watch") CLI.alias(from: "--watch", to: "watch") } - public func run() { + public func run() { let result = CLI.go() - + guard result == CLIResult.success else { exit(result) } - + guard self.router.exitImmediately == false else { exit(result) } - + guard runOnce.contains(where: { $0 == self.router.current } ) else { dispatchMain() } - + exit(result) } } @@ -98,7 +98,7 @@ public class Overlook { public func startup(_ run:String, watching:[String]) { let executing = "executing: " let target = run.bold - + print("\nStarting Overlook...".green.bold) print(executing + target.bold) print("watching:")