import os

import click

from . import chute
from . import device
from . import routers
from . import store


PDSERVER_URL = os.environ.get("PDSERVER_URL", "https://paradrop.org")


@click.group()
@click.pass_context
def root(ctx):
    """
    Paradrop command line utility.

    Environment Variables
        PDSERVER_URL    ParaDrop controller URL [default: https://paradrop.org]
    """
    # Options can be parsed from PDTOOLS_* environment variables.
    ctx.auto_envvar_prefix = 'PDTOOLS'

    # Respond to both -h and --help for all commands.
    ctx.help_option_names = ['-h', '--help']

    ctx.obj = {
        'pdserver_url': PDSERVER_URL
    }


root.add_command(chute.chute)
root.add_command(device.device)
root.add_command(routers.routers)
root.add_command(store.store)


def main():
    """
    Entry point for the pdtools Python package.
    """
    root()


if __name__ == "__main__":
    main()

import os

import click

from . import chute
from . import device
from . import routers
from . import store


PDSERVER_URL = os.environ.get("PDSERVER_URL", "https://paradrop.org")

CONTEXT_SETTINGS = dict(
    # Options can be parsed from PDTOOLS_* environment variables.
    auto_envvar_prefix = 'PDTOOLS',

    # Respond to both -h and --help for all commands.
    help_option_names = ['-h', '--help'],

    obj = {
        'pdserver_url': PDSERVER_URL
    }
)


@click.group(context_settings=CONTEXT_SETTINGS)
def root(ctx):
    """
    Paradrop command line utility.

    Environment Variables
        PDSERVER_URL    ParaDrop controller URL [default: https://paradrop.org]
    """
    pass


root.add_command(chute.chute)
root.add_command(device.device)
root.add_command(routers.routers)
root.add_command(store.store)


def main():
    """
    Entry point for the pdtools Python package.
    """
    root()


if __name__ == "__main__":
    main()

Enable '-h' help option from the pdtools root level.
Enable '-h' help option from the pdtools root level.

  import os
  
  import click
  
  from . import chute
  from . import device
  from . import routers
  from . import store
  
  
  PDSERVER_URL = os.environ.get("PDSERVER_URL", "https://paradrop.org")
  
+ CONTEXT_SETTINGS = dict(
+     # Options can be parsed from PDTOOLS_* environment variables.
+     auto_envvar_prefix = 'PDTOOLS',
  
- @click.group()
- @click.pass_context
+     # Respond to both -h and --help for all commands.
+     help_option_names = ['-h', '--help'],
+ 
+     obj = {
+         'pdserver_url': PDSERVER_URL
+     }
+ )
+ 
+ 
+ @click.group(context_settings=CONTEXT_SETTINGS)
  def root(ctx):
      """
      Paradrop command line utility.
  
      Environment Variables
          PDSERVER_URL    ParaDrop controller URL [default: https://paradrop.org]
      """
+     pass
-     # Options can be parsed from PDTOOLS_* environment variables.
-     ctx.auto_envvar_prefix = 'PDTOOLS'
- 
-     # Respond to both -h and --help for all commands.
-     ctx.help_option_names = ['-h', '--help']
- 
-     ctx.obj = {
-         'pdserver_url': PDSERVER_URL
-     }
  
  
  root.add_command(chute.chute)
  root.add_command(device.device)
  root.add_command(routers.routers)
  root.add_command(store.store)
  
  
  def main():
      """
      Entry point for the pdtools Python package.
      """
      root()
  
  
  if __name__ == "__main__":
      main()
  
Enable '-h' help option from the pdtools root level.
## Code Before:
import os

import click

from . import chute
from . import device
from . import routers
from . import store


PDSERVER_URL = os.environ.get("PDSERVER_URL", "https://paradrop.org")


@click.group()
@click.pass_context
def root(ctx):
    """
    Paradrop command line utility.

    Environment Variables
        PDSERVER_URL    ParaDrop controller URL [default: https://paradrop.org]
    """
    # Options can be parsed from PDTOOLS_* environment variables.
    ctx.auto_envvar_prefix = 'PDTOOLS'

    # Respond to both -h and --help for all commands.
    ctx.help_option_names = ['-h', '--help']

    ctx.obj = {
        'pdserver_url': PDSERVER_URL
    }


root.add_command(chute.chute)
root.add_command(device.device)
root.add_command(routers.routers)
root.add_command(store.store)


def main():
    """
    Entry point for the pdtools Python package.
    """
    root()


if __name__ == "__main__":
    main()

## Instruction:
Enable '-h' help option from the pdtools root level.
## Code After:
import os

import click

from . import chute
from . import device
from . import routers
from . import store


PDSERVER_URL = os.environ.get("PDSERVER_URL", "https://paradrop.org")

CONTEXT_SETTINGS = dict(
    # Options can be parsed from PDTOOLS_* environment variables.
    auto_envvar_prefix = 'PDTOOLS',

    # Respond to both -h and --help for all commands.
    help_option_names = ['-h', '--help'],

    obj = {
        'pdserver_url': PDSERVER_URL
    }
)


@click.group(context_settings=CONTEXT_SETTINGS)
def root(ctx):
    """
    Paradrop command line utility.

    Environment Variables
        PDSERVER_URL    ParaDrop controller URL [default: https://paradrop.org]
    """
    pass


root.add_command(chute.chute)
root.add_command(device.device)
root.add_command(routers.routers)
root.add_command(store.store)


def main():
    """
    Entry point for the pdtools Python package.
    """
    root()


if __name__ == "__main__":
    main()
