Uploaded image for project: 'Cassandra'
  1. Cassandra
  2. CASSANDRA-17236

Add support for short form of version to CQLSH

    XMLWordPrintableJSON

Details

    Description

      Today we do only support the `–version` long option/form for cqlsh and this enhancement Jira is to request that we also offer a shorter version `-v` to cqlsh. This will have consistency benefits with other tools and even match with what we have at `bin/cassandra -v` option for instance.

      Today, `cqlsh` does support `--v` to get the version which is different than the single dashed short form that is available at many other tools. Thanks to Ekaterina for finding this. It looks like this is stemming from Python's parse mechanism which is detailed here, https://docs.python.org/2.7/library/optparse.html#printing-a-version-string.

       

      https://github.com/apache/cassandra/blob/trunk/bin/cqlsh.py#L194-L196

      parser = optparse.OptionParser(description=description, epilog=epilog,
                                     usage="Usage: %prog [options] [host [port]]",
                                     version='cqlsh ' + version)

       

      $ bin/cqlsh --v
      cqlsh 6.0.0

      This looks like a weird implementation at Python. Both (--help) and (--version) options are stemming from here, https://github.com/python/cpython/blob/2.7/Lib/optparse.py#L1248-L1256 and they did decide to ignore the short form option for version and it somehow automatically takes the (--v) option to spit the version info.

      Attachments

        Activity

          People

            yashLadha Yash Ladha
            smadhavan Madhavan
            Yash Ladha
            Brandon Williams, Stefan Miklosovic
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: