CLI in ruby using OptionParser or GetoptLong

This page summarizes the projects mentioned and recommended in the original post on dev.to

InfluxDB - Power Real-Time Data Analytics at Scale
Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
www.influxdata.com
featured
SaaSHub - Software Alternatives and Reviews
SaaSHub helps you find the best software and product alternatives
www.saashub.com
featured
  • cli-kit

    Framework/Engine for command line interfaces

  • Few days ago I've created a script for the project I'm working on. It was an ugly script with hardcoded values, but it did ther job - create tokens on request. But I've decided to improve it a bit, because sometimes I needed to change params and I've added ability to submit params from the command line. Of course, there are a lot of awesome libraries such as dry-cli, TTY Toolkit or cli-kit from Shopify, but in most cases you can use standard ruby libraries like OptionParser or GetoptLong. Lets see how you can create a CLI utils with those libraries just in few minutes.

  • getoptlong

    The GetoptLong class allows you to parse command line options similarly to the GNU getopt_long() C library call.

  • We will start with GetoptLong library.

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

    InfluxDB logo
  • optparse

    OptionParser is a class for command-line option analysis. (by ruby)

  • Next stop - OptionParser. Similar with GetoptLong we create an instance of OptionParser class with list of available params. There are an opts.banner option which allow us to add some text before list of available params.

  • TTY

    Toolkit for developing sleek command line apps.

  • Few days ago I've created a script for the project I'm working on. It was an ugly script with hardcoded values, but it did ther job - create tokens on request. But I've decided to improve it a bit, because sometimes I needed to change params and I've added ability to submit params from the command line. Of course, there are a lot of awesome libraries such as dry-cli, TTY Toolkit or cli-kit from Shopify, but in most cases you can use standard ruby libraries like OptionParser or GetoptLong. Lets see how you can create a CLI utils with those libraries just in few minutes.

  • dry-cli

    General purpose Command Line Interface (CLI) framework for Ruby

  • Few days ago I've created a script for the project I'm working on. It was an ugly script with hardcoded values, but it did ther job - create tokens on request. But I've decided to improve it a bit, because sometimes I needed to change params and I've added ability to submit params from the command line. Of course, there are a lot of awesome libraries such as dry-cli, TTY Toolkit or cli-kit from Shopify, but in most cases you can use standard ruby libraries like OptionParser or GetoptLong. Lets see how you can create a CLI utils with those libraries just in few minutes.

  • SaaSHub

    SaaSHub - Software Alternatives and Reviews. SaaSHub helps you find the best software and product alternatives

    SaaSHub logo
NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts

  • I'd like to read manually input data and prompt for the next bit of data at the terminal without getting newlines.

    1 project | /r/ruby | 30 Aug 2022
  • What library can I use to create a TUI

    3 projects | /r/ruby | 13 Jul 2022
  • Looking for a tutorial or a resource to write good looking CLI applications

    4 projects | /r/golang | 22 Jul 2021
  • Building Rich terminal dashboards

    2 projects | /r/programming | 16 Feb 2021
  • Ncurses in Ruby style?

    3 projects | /r/ruby | 22 Apr 2023