jakeheis / SwiftCLI

A powerful framework for developing CLIs in Swift
MIT License
861 stars 72 forks source link

I can't find command #68

Closed LinMaris closed 5 years ago

LinMaris commented 6 years ago
~ > greeter greet Jack
Expected 2 arguments, but got 1.

my terminal is $, not >, I use SwiftCLI by SwiftPM, but I can't find command greeter greet, Where did I go wrong? and I need to install Ice ?

jakeheis commented 6 years ago

Could you post some of your code? It's hard to diagnose the issue without seeing the code itself

Samasaur1 commented 5 years ago
~ > greeter greet Jack
Expected 2 arguments, but got 1.

This was just an example. If you compiled the first block of code in the README:


import SwiftCLI

class GreetCommand: Command { let name = "greet" let person = Parameter() func execute() throws { stdout <<< "Hello (person.value)!" } }

let greeter = CLI(name: "greeter") greeter.commands = [GreetCommand()] greeter.go()


and put the file somewhere in your $PATH, you could run it by doing `greeter greet Jack`. My guess is that your code is slightly differenct.
***
> Where did I go wrong? and I need to install `Ice` ?
[Ice](https://github.com/jakeheis/Ice) is a command line tool that runs on top of the Swift Package Manager. You don't need it in order to install SwiftCLI.
***
I hope I answered your questions, and I'm sorry if I misunderstood you.
jakeheis commented 5 years ago

I think @Samasaur1 addressed your confusion fully, feel free to reopen this with more details if need be