Skip to content

Commit

Permalink
switch to using CommandRegistry
Browse files Browse the repository at this point in the history
  • Loading branch information
g-Off committed Dec 11, 2018
1 parent 18d8b68 commit 2447b0b
Show file tree
Hide file tree
Showing 10 changed files with 31 additions and 81 deletions.
18 changes: 18 additions & 0 deletions Package.resolved
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
{
"object": {
"pins": [
{
"package": "CommandRegistry",
"repositoryURL": "https://github.com/g-Off/CommandRegistry.git",
"state": {
"branch": "master",
"revision": "142aa27445e7998c5201b5ec9682698195d6701a",
"version": null
}
},
{
"package": "SwiftPM",
"repositoryURL": "https://github.com/apple/swift-package-manager.git",
Expand All @@ -19,6 +28,15 @@
"version": "0.8.2"
}
},
{
"package": "XcodeProject",
"repositoryURL": "https://github.com/g-Off/XcodeProject.git",
"state": {
"branch": null,
"revision": "a1e12a8659684039258b79761c65abb9ec98fc94",
"version": "0.4.0"
}
},
{
"package": "Yams",
"repositoryURL": "https://github.com/jpsim/Yams.git",
Expand Down
8 changes: 4 additions & 4 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@ import PackageDescription
let package = Package(
name: "stringray",
dependencies: [
.package(url: "https://github.com/apple/swift-package-manager.git", from: "0.3.0"),
.package(url: "https://github.com/jpsim/Yams.git", from: "1.0.1"),
.package(url: "https://github.com/scottrhoyt/SwiftyTextTable.git", from: "0.5.0"),
.package(url: "https://github.com/g-Off/XcodeProject.git", .branch("master"))
.package(url: "https://github.com/g-Off/XcodeProject.git", from: "0.4.0"),
.package(url: "https://github.com/g-Off/CommandRegistry.git", .branch("master"))
],
targets: [
.target(
name: "stringray",
dependencies: [
"Utility",
"Yams",
"SwiftyTextTable",
"XcodeProject"
"XcodeProject",
"CommandRegistry"
]
),
.testTarget(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,13 @@
//
// Command.swift
// Command+Extensions.swift
// stringray
//
// Created by Geoffrey Foster on 2018-11-04.
//

import Foundation
import Utility

protocol Command {
var command: String { get }
var overview: String { get }

init(parser: ArgumentParser)
func run(with arguments: ArgumentParser.Result) throws
}
import CommandRegistry

extension Command {
func write(to url: Foundation.URL, table: StringsTable) throws {
Expand Down
67 changes: 0 additions & 67 deletions Sources/stringray/Commands/CommandRegistry.swift

This file was deleted.

1 change: 1 addition & 0 deletions Sources/stringray/Commands/CopyCommand.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import Foundation
import Utility
import CommandRegistry

struct CopyCommand: Command {
private struct Arguments {
Expand Down
1 change: 1 addition & 0 deletions Sources/stringray/Commands/LintCommand.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import Utility
import Basic
import SwiftyTextTable
import XcodeProject
import CommandRegistry

struct LintCommand: Command {
private struct Arguments {
Expand Down
1 change: 1 addition & 0 deletions Sources/stringray/Commands/MoveCommand.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import Foundation
import Utility
import CommandRegistry

struct MoveCommand: Command {
private struct Arguments {
Expand Down
1 change: 1 addition & 0 deletions Sources/stringray/Commands/RenameCommand.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import Foundation
import Utility
import CommandRegistry

struct RenameCommand: Command {
private struct Arguments {
Expand Down
1 change: 1 addition & 0 deletions Sources/stringray/Commands/SortCommand.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import Foundation
import Utility
import CommandRegistry

struct SortCommand: Command {
private struct Arguments {
Expand Down
3 changes: 2 additions & 1 deletion Sources/stringray/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@

import Foundation
import Utility
import CommandRegistry

var registry = CommandRegistry(usage: "<command> <options>", overview: "", version: Version(0, 1, 1))
var registry = Registry(usage: "<command> <options>", overview: "", version: Version(0, 1, 1))
registry.register(command: MoveCommand.self)
registry.register(command: CopyCommand.self)
registry.register(command: SortCommand.self)
Expand Down

0 comments on commit 2447b0b

Please sign in to comment.