
"""The command-line ``flocker-volume`` tool."""

import sys

from twisted.python.usage import Options
from twisted.python.filepath import FilePath
from twisted.internet.task import react
from twisted.internet.defer import succeed

from .service import VolumeService
from .. import __version__


class FlockerVolumeOptions(Options):
    """flocker-volume - volume management."""

    optParameters = [
        ["config", None, b"/etc/flocker/volume.json",
         "The path to the config file."],
    ]

    def postOptions(self):
        self["config"] = FilePath(self["config"])

    def opt_version(self):
        print(__version__)
        raise SystemExit(0)


def _main(reactor, *arguments):
    """Parse command-line options and use them to run volume management."""
    # Much of this should be moved (and expanded) into shared class:
    # https://github.com/hybridlogic/flocker/issues/30
    options = FlockerVolumeOptions()
    options.parseOptions(arguments)
    service = VolumeService(options["config"])
    service.startService()
    return succeed(None)


def main():
    """Entry point to the ``flocker-volume`` command-line tool."""
    react(_main, sys.argv[1:])


"""The command-line ``flocker-volume`` tool."""

import sys

from twisted.python.usage import Options
from twisted.python.filepath import FilePath
from twisted.internet.task import react
from twisted.internet.defer import succeed

from .service import VolumeService
from .. import __version__


class FlockerVolumeOptions(Options):
    """Command line options for ``flocker-volume`` volume management tool."""

    longdesc = """flocker-volume allows you to manage volumes, filesystems
    that can be attached to Docker containers.

    At the moment no functionality has been implemented.
    """

    optParameters = [
        ["config", None, b"/etc/flocker/volume.json",
         "The path to the config file."],
    ]

    def postOptions(self):
        self["config"] = FilePath(self["config"])

    def opt_version(self):
        """Print the program's version and exit."""
        print(__version__)
        raise SystemExit(0)


def _main(reactor, *arguments):
    """Parse command-line options and use them to run volume management."""
    # Much of this should be moved (and expanded) into shared class:
    # https://github.com/hybridlogic/flocker/issues/30
    options = FlockerVolumeOptions()
    options.parseOptions(arguments)
    service = VolumeService(options["config"])
    service.startService()
    return succeed(None)


def main():
    """Entry point to the ``flocker-volume`` command-line tool."""
    react(_main, sys.argv[1:])

Address review comment: More useful help output.
Address review comment: More useful help output.

  
  """The command-line ``flocker-volume`` tool."""
  
  import sys
  
  from twisted.python.usage import Options
  from twisted.python.filepath import FilePath
  from twisted.internet.task import react
  from twisted.internet.defer import succeed
  
  from .service import VolumeService
  from .. import __version__
  
  
  class FlockerVolumeOptions(Options):
-     """flocker-volume - volume management."""
+     """Command line options for ``flocker-volume`` volume management tool."""
+ 
+     longdesc = """flocker-volume allows you to manage volumes, filesystems
+     that can be attached to Docker containers.
+ 
+     At the moment no functionality has been implemented.
+     """
  
      optParameters = [
          ["config", None, b"/etc/flocker/volume.json",
           "The path to the config file."],
      ]
  
      def postOptions(self):
          self["config"] = FilePath(self["config"])
  
      def opt_version(self):
+         """Print the program's version and exit."""
          print(__version__)
          raise SystemExit(0)
  
  
  def _main(reactor, *arguments):
      """Parse command-line options and use them to run volume management."""
      # Much of this should be moved (and expanded) into shared class:
      # https://github.com/hybridlogic/flocker/issues/30
      options = FlockerVolumeOptions()
      options.parseOptions(arguments)
      service = VolumeService(options["config"])
      service.startService()
      return succeed(None)
  
  
  def main():
      """Entry point to the ``flocker-volume`` command-line tool."""
      react(_main, sys.argv[1:])
  
Address review comment: More useful help output.
## Code Before:

"""The command-line ``flocker-volume`` tool."""

import sys

from twisted.python.usage import Options
from twisted.python.filepath import FilePath
from twisted.internet.task import react
from twisted.internet.defer import succeed

from .service import VolumeService
from .. import __version__


class FlockerVolumeOptions(Options):
    """flocker-volume - volume management."""

    optParameters = [
        ["config", None, b"/etc/flocker/volume.json",
         "The path to the config file."],
    ]

    def postOptions(self):
        self["config"] = FilePath(self["config"])

    def opt_version(self):
        print(__version__)
        raise SystemExit(0)


def _main(reactor, *arguments):
    """Parse command-line options and use them to run volume management."""
    # Much of this should be moved (and expanded) into shared class:
    # https://github.com/hybridlogic/flocker/issues/30
    options = FlockerVolumeOptions()
    options.parseOptions(arguments)
    service = VolumeService(options["config"])
    service.startService()
    return succeed(None)


def main():
    """Entry point to the ``flocker-volume`` command-line tool."""
    react(_main, sys.argv[1:])

## Instruction:
Address review comment: More useful help output.
## Code After:

"""The command-line ``flocker-volume`` tool."""

import sys

from twisted.python.usage import Options
from twisted.python.filepath import FilePath
from twisted.internet.task import react
from twisted.internet.defer import succeed

from .service import VolumeService
from .. import __version__


class FlockerVolumeOptions(Options):
    """Command line options for ``flocker-volume`` volume management tool."""

    longdesc = """flocker-volume allows you to manage volumes, filesystems
    that can be attached to Docker containers.

    At the moment no functionality has been implemented.
    """

    optParameters = [
        ["config", None, b"/etc/flocker/volume.json",
         "The path to the config file."],
    ]

    def postOptions(self):
        self["config"] = FilePath(self["config"])

    def opt_version(self):
        """Print the program's version and exit."""
        print(__version__)
        raise SystemExit(0)


def _main(reactor, *arguments):
    """Parse command-line options and use them to run volume management."""
    # Much of this should be moved (and expanded) into shared class:
    # https://github.com/hybridlogic/flocker/issues/30
    options = FlockerVolumeOptions()
    options.parseOptions(arguments)
    service = VolumeService(options["config"])
    service.startService()
    return succeed(None)


def main():
    """Entry point to the ``flocker-volume`` command-line tool."""
    react(_main, sys.argv[1:])
