创建漂亮的Fastlane /命令行输出

时间:2019-02-21 18:35:56

标签: swift fastlane

正在寻找一些Swift / Fastlane帮助。当未正确调用命令时,如何提醒用户?

例如,我有一个create命令,需要特定输入:

func createLane(withOptions options: [String: String]?) {
  guard let options = options, let domain = options["domain"] else {
    fatalError("Must specify a `domain` argument")
  }
}

fastlane create domain:hello可以按预期成功,但是如果我在没有参数fastlane create的情况下运行它,则会收到大量不必要的文本:

[11:27:28]: ▸ Fatal error: Must specify a `domain` argument: file /Users/kelvinlau/Desktop/Bookeroo/fastlane/Fastfile.swift, line 15
[11:27:28]: ▸ sh: line 1: 16583 Illegal instruction: 4  ./fastlane/FastlaneRunner lane create swiftServerPort 2000 > /dev/null
+-----------+--------+
|    Lane Context    |
+-----------+--------+
| LANE_NAME | create |
+-----------+--------+
[11:27:28]: 765: unexpected token at ''
[11:27:28]: fastlane finished with errors

Looking for related GitHub issues on fastlane/fastlane...

➡️  784/776: unexpected token at 'Bad Request' (Faraday::ParsingError)
    https://github.com/fastlane/fastlane/issues/13666 [closed] 56 
    6 weeks ago

➡️  FastlaneSwiftRunner[setGithubRelease]- Fatal error: Unexpectedly found nil while unwrapping an Optional value
    https://github.com/fastlane/fastlane/issues/13852 [closed] 4 
    5 weeks ago

➡️  Provisioning Profile Delete Error Token
    https://github.com/fastlane/fastlane/issues/13256 [closed] 5 
    02 Nov 2018

and 10 more at: https://github.com/fastlane/fastlane/search?q=765%3A%20unexpected%20token%20at%20%27%27&type=Issues&utf8=✓

  You can ⌘ + double-click on links to open them directly in your browser.
/Users/kelvinlau/.rbenv/versions/2.3.7/lib/ruby/gems/2.3.0/gems/json-2.1.0/lib/json/common.rb:156:in `parse': [!] 765: unexpected token at '' (JSON::ParserError)
    from /Users/kelvinlau/.rbenv/versions/2.3.7/lib/ruby/gems/2.3.0/gems/json-2.1.0/lib/json/common.rb:156:in `parse'
    from /Users/kelvinlau/.rbenv/versions/2.3.7/lib/ruby/gems/2.3.0/gems/fastlane-2.116.1/fastlane/lib/fastlane/server/command_parser.rb:12:in `parse'
    from /Users/kelvinlau/.rbenv/versions/2.3.7/lib/ruby/gems/2.3.0/gems/fastlane-2.116.1/fastlane/lib/fastlane/server/socket_server.rb:81:in `parse_and_execute_command'
    from /Users/kelvinlau/.rbenv/versions/2.3.7/lib/ruby/gems/2.3.0/gems/fastlane-2.116.1/fastlane/lib/fastlane/server/socket_server.rb:62:in `block in receive_and_process_commands'
    from /Users/kelvinlau/.rbenv/versions/2.3.7/lib/ruby/gems/2.3.0/gems/fastlane-2.116.1/fastlane/lib/fastlane/server/socket_server.rb:49:in `loop'
    from /Users/kelvinlau/.rbenv/versions/2.3.7/lib/ruby/gems/2.3.0/gems/fastlane-2.116.1/fastlane/lib/fastlane/server/socket_server.rb:49:in `receive_and_process_commands'
    from /Users/kelvinlau/.rbenv/versions/2.3.7/lib/ruby/gems/2.3.0/gems/fastlane-2.116.1/fastlane/lib/fastlane/server/socket_server.rb:158:in `listen'
    from /Users/kelvinlau/.rbenv/versions/2.3.7/lib/ruby/gems/2.3.0/gems/fastlane-2.116.1/fastlane/lib/fastlane/server/socket_server.rb:38:in `start'
    from /Users/kelvinlau/.rbenv/versions/2.3.7/lib/ruby/gems/2.3.0/gems/fastlane-2.116.1/fastlane/lib/fastlane/swift_lane_manager.rb:231:in `block in start_socket_thread'

对于cmd行,fatalError是这样做的错误方法吗?我不要大量无用的输出。

0 个答案:

没有答案