<kbd id="afajh"><form id="afajh"></form></kbd>
<strong id="afajh"><dl id="afajh"></dl></strong>
    <del id="afajh"><form id="afajh"></form></del>
        1. <th id="afajh"><progress id="afajh"></progress></th>
          <b id="afajh"><abbr id="afajh"></abbr></b>
          <th id="afajh"><progress id="afajh"></progress></th>

          CommanderRuby 命令行框架

          聯(lián)合創(chuàng)作 · 2023-10-01 11:27

          Commander 是 Ruby 命令行執(zhí)行補全解決方案。

          安裝:

          $ gem install commander

          代碼示例:

          require 'rubygems'
          require 'commander/import'
          # :name is optional, otherwise uses the basename of this executable
          program :name, 'Foo Bar'
          program :version, '1.0.0'
          program :description, 'Stupid command that prints foo or bar.'
          command :foo do |c|
            c.syntax = 'foobar foo'
            c.description = 'Displays foo'
            c.action do |args, options|
              say 'foo'
            end
          end
          command :bar do |c|
            c.syntax = 'foobar bar [options]'
            c.description = 'Display bar with optional prefix and suffix'
            c.option '--prefix STRING', String, 'Adds a prefix to bar'
            c.option '--suffix STRING', String, 'Adds a suffix to bar'
            c.action do |args, options|
              options.default :prefix => '(', :suffix => ')'
              say "#{options.prefix}bar#{options.suffix}"
            end
          end

          示例輸出:

          $ foobar bar
          # => (bar)
          
          $ foobar bar --suffix '}' --prefix '{'
          # => {bar}
          瀏覽 20
          點贊
          評論
          收藏
          分享

          手機掃一掃分享

          編輯 分享
          舉報
          評論
          圖片
          表情
          推薦
          點贊
          評論
          收藏
          分享

          手機掃一掃分享

          編輯 分享
          舉報
          <kbd id="afajh"><form id="afajh"></form></kbd>
          <strong id="afajh"><dl id="afajh"></dl></strong>
            <del id="afajh"><form id="afajh"></form></del>
                1. <th id="afajh"><progress id="afajh"></progress></th>
                  <b id="afajh"><abbr id="afajh"></abbr></b>
                  <th id="afajh"><progress id="afajh"></progress></th>
                  999国产精品视频 | 中文字幕+乱码+中文字幕明步 | 学生妹一区二区三区 | 四虎在线无码免费精品 | 玖玖精品视频在线观看 |