{"id":46949,"date":"2017-02-04T08:41:37","date_gmt":"2017-02-03T23:41:37","guid":{"rendered":"http:\/\/www.softantenna.com\/wp\/?p=46949"},"modified":"2017-02-04T08:41:37","modified_gmt":"2017-02-03T23:41:37","slug":"the-ruby-terminal-apps-toolkit","status":"publish","type":"post","link":"https:\/\/softantenna.com\/blog\/the-ruby-terminal-apps-toolkit\/","title":{"rendered":"The Ruby terminal apps toolkit - \u30d7\u30ed\u30b0\u30ec\u30b9\u30d0\u30fc\u3084\u30b9\u30d4\u30ca\u30fc\u7b49\u30bf\u30fc\u30df\u30ca\u30eb\u30a2\u30d7\u30ea\u3092\u4f5c\u6210\u3059\u308b\u969b\u306b\u4fbf\u5229\u306aRuby\u7528gem\u8a70\u3081\u5408\u308f\u305b\u30ad\u30c3\u30c8"},"content":{"rendered":"<p><img decoding=\"async\" style=\"display:block; margin-left:auto; margin-right:auto;\" src=\"https:\/\/softantenna.com\/blog\/wp-content\/uploads\/2017\/02\/Is_20170203_113558.jpg\" alt=\"S 20170203 113558\" title=\"s_20170203_113558.jpg\" border=\"0\" width=\"821\" height=\"499\" \/><\/p>\n<p>\u65e5\u672c\u751f\u307e\u308c\u306e\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u6307\u5411\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u8a00\u8a9e\u300cRuby\u300d\u3002Rails\u7b49\u306eWeb\u30a2\u30d7\u30ea\u3067\u3082\u6d3b\u8e8d\u3057\u3066\u3044\u307e\u3059\u304c\u3001\u30b7\u30a7\u30eb\u30b9\u30af\u30ea\u30d7\u30c8\u306e\u304b\u308f\u308a\u306b\u3061\u3087\u3063\u3068\u3057\u305f\u51e6\u7406\u3092\u884c\u3046\u3001\u30b3\u30de\u30f3\u30c9\u30e9\u30a4\u30f3\u30c4\u30fc\u30eb\u4f5c\u6210\u8a00\u8a9e\u3068\u3057\u3066\u3082\u4fbf\u5229\u306b\u4f7f\u7528\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u672c\u65e5\u7d39\u4ecb\u3059\u308b\u300c<a href=\"http:\/\/piotrmurach.github.io\/tty\/\">The Ruby terminal apps toolkit<\/a>\u300d\u306f\u3001\u305d\u306e\u3088\u3046\u306a\u30b3\u30de\u30f3\u30c9\u30e9\u30a4\u30f3\u30c4\u30fc\u30eb\u3092\u4f5c\u6210\u3059\u308b\u969b\u306b\u4fbf\u5229\u306agem\u3092\u307e\u3068\u3081\u3066\u63d0\u4f9b\u3059\u308b\u30c4\u30fc\u30eb\u30ad\u30c3\u30c8\u3067\u3059\u3002<\/p>\n<p>The Ruby terminal apps toolkit\u3068\u3057\u3066\u63d0\u4f9b\u3055\u308c\u3066\u3044\u308b\u5168\u90e8\u306egem\u3092\u307e\u3068\u3081\u3066\u5c0e\u5165\u3059\u308b\u3053\u3068\u3082\u3067\u304d\u307e\u3059\u3057\u3001\u5fc5\u8981\u306agem\u3060\u3051\u3092\u5358\u4f53\u3067\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u3053\u3068\u3082\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u4ee5\u4e0b\u5b9f\u969b\u306e\u4f7f\u7528\u6cd5\u3092\u8aac\u660e\u3057\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<h2>\u4f7f\u7528\u65b9\u6cd5<\/h2>\n<p>\u5168\u3066\u306egem\u3092\u307e\u3068\u3081\u3066\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u305f\u3044\u5834\u5408\u3001\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5165\u529b\u3057\u307e\u3059\u3002<\/p>\n<pre>\n$ gem install tty\n<\/pre>\n<p>\u5358\u4f53\u306egem\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u305f\u3044\u5834\u5408\u306f\u4ee5\u4e0b\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre>\n$ gem install tty-prompt\n<\/pre>\n<p>\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u53ef\u80fd\u306agem\u306e\u540d\u524d\u306f\u516c\u5f0f\u30b5\u30a4\u30c8\u30c8\u30c3\u30d7\u3092\u898b\u308c\u3070\u5206\u304b\u308a\u307e\u3059\u3002<\/p>\n<p>\u30d7\u30ed\u30f3\u30d7\u30c8\u6a5f\u80fd\u3092\u63d0\u4f9b\u3059\u308btty-prompt\u306e\u307b\u304b\u3001\u30d7\u30ed\u30b0\u30ec\u30b9\u30d0\u30fc\u6a5f\u80fd\u3092\u63d0\u4f9b\u3059\u308btty-progressbar\u3001\u30b9\u30d4\u30ca\u30fc\u306etty-spinner\u3001\u30b7\u30a7\u30eb\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3059\u308btty-command\u3001\u30c6\u30fc\u30d6\u30eb\u8868\u793a\u306etty-table\u2026\u306a\u3069\u304c\u5b58\u5728\u3059\u308b\u3053\u3068\u304c\u308f\u304b\u308a\u307e\u3059\u3002<\/p>\n<p>\u5168\u90e8\u307e\u3068\u3081\u3066\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u300cgem install tty\u300d\u3092\u5b9f\u884c\u3059\u308b\u3068\u3001\u3053\u308c\u3089\u306e\u500b\u5225gem\u304c\u307e\u3068\u3081\u3066\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3055\u308c\u308b\u306e\u3067\u3059\u3002<\/p>\n<p><img decoding=\"async\" style=\"display:block; margin-left:auto; margin-right:auto;\" src=\"https:\/\/softantenna.com\/blog\/wp-content\/uploads\/2017\/02\/Is_20170203_114436.jpg\" alt=\"S 20170203 114436\" title=\"s_20170203_114436.jpg\" border=\"0\" width=\"1073\" height=\"583\" \/><\/p>\n<p>\u5177\u4f53\u7684\u306a\u4f7f\u7528\u6cd5\u306f\u3001gem\u305d\u308c\u305e\u308c\u306eGitHub\u30da\u30fc\u30b8\u306b\u63b2\u8f09\u3055\u308c\u3066\u3044\u307e\u3059\u3002\u4f8b\u3048\u3070<a href=\"https:\/\/github.com\/piotrmurach\/tty-prompt#ttyprompt-\">tty-prompt<\/a>\u3001<a href=\"https:\/\/github.com\/piotrmurach\/tty-progressbar#ttyprogressbar-\">tty-progressbar<\/a>\u3001<a href=\"https:\/\/github.com\/piotrmurach\/tty-table#ttytable-\">tty-table<\/a>\u306e\u4f7f\u7528\u4f8b\u306f\u6b21\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre><code class=\"ruby\"># coding: utf-8\nrequire 'tty-prompt'\nrequire 'tty-progressbar'\nrequire 'tty-table'\n\n# \u30d7\u30ed\u30f3\u30d7\u30c8\nprompt = TTY::Prompt.new\nchoices = %w(vodka beer wine whisky bourbon)\nprompt.multi_select(\"Select drinks?\", choices)\n\n# \u30d7\u30ed\u30b0\u30ec\u30b9\u30d0\u30fc\nbar = TTY::ProgressBar.new(\"downloading [:bar]\", total: 30)\n30.times do\n  sleep(0.1)\n  bar.advance(1)\nend\n\n# \u30c6\u30fc\u30d6\u30eb\ntable = TTY::Table.new ['header1','header2'], [['a1', 'a2'], ['b1', 'b2']]\nprint table.render(:ascii)\n<\/code><\/pre>\n<p>\u624b\u4f5c\u696d\u3067\u5b9f\u88c5\u3057\u3088\u3046\u3068\u3059\u308b\u3068\u3081\u3093\u3069\u304f\u3055\u3044\u5404\u7a2e\u51e6\u7406\u304c\u76f4\u611f\u7684\u306b\u8a18\u8ff0\u3067\u304d\u308b\u3053\u3068\u304c\u308f\u304b\u308a\u307e\u3059\u3002<\/p>\n<p><img decoding=\"async\" style=\"display:block; margin-left:auto; margin-right:auto;\" src=\"https:\/\/softantenna.com\/blog\/wp-content\/uploads\/2017\/02\/Is_20170203_115026.jpg\" alt=\"S 20170203 115026\" title=\"s_20170203_115026.jpg\" border=\"0\" width=\"759\" height=\"484\" \/><\/p>\n<p>\u25b2\u5b9f\u884c\u4f8b\u3002\u9032\u6357\u72b6\u6cc1\u306e\u8868\u793a\u306b\u4fbf\u5229\u306a\u30d7\u30ed\u30b0\u30ec\u30b9\u30d0\u30fc\u3084\u3001\u30c7\u30fc\u30bf\u3092\u5206\u304b\u308a\u3084\u3059\u304f\u8868\u793a\u3067\u304d\u308b\u30c6\u30fc\u30d6\u30eb\u304c\u30bf\u30fc\u30df\u30ca\u30eb\u306b\u63cf\u753b\u3067\u304d\u307e\u3057\u305f(\u30d7\u30ed\u30f3\u30d7\u30c8\u306f\u30e6\u30fc\u30b6\u30fc\u306e\u5165\u529b\u3092\u53d7\u3051\u53d6\u308b\u6a5f\u80fd\u3067\u3059)\u3002<\/p>\n<h2>\u307e\u3068\u3081<\/h2>\n<p>The Ruby terminal apps toolkit\u3092\u5229\u7528\u3059\u308c\u3070\u3001\u30b3\u30de\u30f3\u30c9\u30e9\u30a4\u30f3\u30c4\u30fc\u30eb\u3092\u4f5c\u6210\u3059\u308b\u969b\u306b\u5fc5\u8981\u3068\u306a\u308b\u300c\u3061\u3087\u3063\u3068\u6c17\u306e\u5229\u3044\u305f\u51e6\u7406\u300d\u3092\u7c21\u5358\u306b\u8ffd\u52a0\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u65e5\u5e38\u4f7f\u3044\u306e\u30c4\u30fc\u30eb\u3092\u4f5c\u6210\u3057\u305f\u3044Ruby\u958b\u767a\u8005\u5fc5\u898b\u306e\u30e9\u30a4\u30d6\u30e9\u30ea\u3068\u3044\u3048\u308b\u3067\u3057\u3087\u3046\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u65e5\u672c\u751f\u307e\u308c\u306e\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u6307\u5411\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u8a00\u8a9e\u300cRuby\u300d\u3002Rails\u7b49\u306eWeb\u30a2\u30d7\u30ea\u3067\u3082\u6d3b\u8e8d\u3057\u3066\u3044\u307e\u3059\u304c\u3001\u30b7\u30a7\u30eb\u30b9\u30af\u30ea\u30d7\u30c8\u306e\u304b\u308f\u308a\u306b\u3061\u3087\u3063\u3068\u3057\u305f\u51e6\u7406\u3092\u884c\u3046\u3001\u30b3\u30de\u30f3\u30c9\u30e9\u30a4\u30f3\u30c4\u30fc\u30eb\u4f5c\u6210\u8a00\u8a9e\u3068\u3057\u3066\u3082\u4fbf\u5229\u306b\u4f7f\u7528\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":46954,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"swell_btn_cv_data":"","footnotes":""},"categories":[3459],"tags":[154,1211],"class_list":["post-46949","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-review","tag-ruby","tag-terminal"],"_links":{"self":[{"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/posts\/46949","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/comments?post=46949"}],"version-history":[{"count":0,"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/posts\/46949\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/media\/46954"}],"wp:attachment":[{"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/media?parent=46949"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/categories?post=46949"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/tags?post=46949"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}