Beispiel #1
0
 def _LoadHelpMaps(self):
   """Returns tuple (help type -> [HelpProviders],
                     help name->HelpProvider dict,
                    )."""
   # Walk gslib/commands and gslib/addlhelp to find all HelpProviders.
   for f in os.listdir(os.path.join(gslib.GSLIB_DIR, 'commands')):
     # Handles no-extension files, etc.
     (module_name, ext) = os.path.splitext(f)
     if ext == '.py':
       __import__('gslib.commands.%s' % module_name)
   for f in os.listdir(os.path.join(gslib.GSLIB_DIR, 'addlhelp')):
     (module_name, ext) = os.path.splitext(f)
     if ext == '.py':
       __import__('gslib.addlhelp.%s' % module_name)
   help_type_map = {}
   help_name_map = {}
   for s in gslib.help_provider.ALL_HELP_TYPES:
     help_type_map[s] = []
   # Only include HelpProvider subclasses in the dict.
   for help_prov in itertools.chain(
       HelpProvider.__subclasses__(), Command.__subclasses__()):
     if help_prov is Command:
       # Skip the Command base class itself; we just want its subclasses,
       # where the help command text lives (in addition to non-Command
       # HelpProviders, like naming.py).
       continue
     gslib.help_provider.SanityCheck(help_prov, help_name_map)
     help_name_map[help_prov.help_spec[HELP_NAME]] = help_prov
     for help_name_aliases in help_prov.help_spec[HELP_NAME_ALIASES]:
       help_name_map[help_name_aliases] = help_prov
     help_type_map[help_prov.help_spec[HELP_TYPE]].append(help_prov)
   return (help_type_map, help_name_map)
Beispiel #2
0
  def _LoadHelpMaps(self):
    """Returns tuple (help type -> [HelpProviders],
                      help name->HelpProvider dict,
                     )."""

    # Import all gslib.commands submodules.
    for _, module_name, _ in pkgutil.iter_modules(gslib.commands.__path__):
      __import__('gslib.commands.%s' % module_name)
    # Import all gslib.addlhelp submodules.
    for _, module_name, _ in pkgutil.iter_modules(gslib.addlhelp.__path__):
      __import__('gslib.addlhelp.%s' % module_name)

    help_type_map = {}
    help_name_map = {}
    for s in gslib.help_provider.ALL_HELP_TYPES:
      help_type_map[s] = []
    # Only include HelpProvider subclasses in the dict.
    for help_prov in itertools.chain(
        HelpProvider.__subclasses__(), Command.__subclasses__()):
      if help_prov is Command:
        # Skip the Command base class itself; we just want its subclasses,
        # where the help command text lives (in addition to non-Command
        # HelpProviders, like naming.py).
        continue
      gslib.help_provider.SanityCheck(help_prov, help_name_map)
      help_name_map[help_prov.help_spec[HELP_NAME]] = help_prov
      for help_name_aliases in help_prov.help_spec[HELP_NAME_ALIASES]:
        help_name_map[help_name_aliases] = help_prov
      help_type_map[help_prov.help_spec[HELP_TYPE]].append(help_prov)
    return (help_type_map, help_name_map)
Beispiel #3
0
class CommandOptions(HelpProvider):
    """Additional help about security and privacy considerations using gsutil."""

    # Help specification. See help_provider.py for documentation.
    help_spec = HelpProvider.HelpSpec(
        help_name='security',
        help_name_aliases=[
            'encryption', 'protection', 'privacy', 'proxies', 'proxy'
        ],
        help_type='additional_help',
        help_one_line_summary='Security and Privacy Considerations',
        help_text=_DETAILED_HELP_TEXT,
        subcommand_help_text={},
    )
Beispiel #4
0
class CommandOptions(HelpProvider):
    """Additional help about object metadata."""

    # Help specification. See help_provider.py for documentation.
    help_spec = HelpProvider.HelpSpec(
        help_name='metadata',
        help_name_aliases=[
            'cache-control', 'caching', 'content type', 'mime type', 'mime',
            'type'
        ],
        help_type='additional_help',
        help_one_line_summary='Working With Object Metadata',
        help_text=_DETAILED_HELP_TEXT,
        subcommand_help_text={},
    )
Beispiel #5
0
class CommandOptions(HelpProvider):
    """Additional help about using gsutil for production tasks."""

    # Help specification. See help_provider.py for documentation.
    help_spec = HelpProvider.HelpSpec(
        help_name='prod',
        help_name_aliases=[
            'production', 'resumable', 'resumable upload',
            'resumable transfer', 'resumable download', 'scripts', 'scripting'
        ],
        help_type='additional_help',
        help_one_line_summary='Scripting Production Transfers',
        help_text=_DETAILED_HELP_TEXT,
        subcommand_help_text={},
    )
Beispiel #6
0
class CommandOptions(HelpProvider):
    """Additional help about filename encoding and interoperability problems."""

    # Help specification. See help_provider.py for documentation.
    help_spec = HelpProvider.HelpSpec(
        help_name='encoding',
        help_name_aliases=[
            'encodings', 'utf8', 'utf-8', 'latin1', 'unicode',
            'interoperability'
        ],
        help_type='additional_help',
        help_one_line_summary='Filename encoding and interoperability problems',
        help_text=_DETAILED_HELP_TEXT,
        subcommand_help_text={},
    )
Beispiel #7
0
class CommandOptions(HelpProvider):
    """Additional help about Access Control Lists."""

    # Help specification. See help_provider.py for documentation.
    help_spec = HelpProvider.HelpSpec(
        help_name='acls',
        help_name_aliases=[
            'ACL', 'access control', 'access control list', 'authorization',
            'canned', 'canned acl'
        ],
        help_type='additional_help',
        help_one_line_summary='Working With Access Control Lists',
        help_text=_DETAILED_HELP_TEXT,
        subcommand_help_text={},
    )
class CommandOptions(HelpProvider):
    """Additional help about Google Cloud Storage projects."""

    # Help specification. See help_provider.py for documentation.
    help_spec = HelpProvider.HelpSpec(
        help_name='projects',
        help_name_aliases=[
            'apis console', 'cloud console', 'console', 'dev console',
            'project', 'proj', 'project-id'
        ],
        help_type='additional_help',
        help_one_line_summary='Working With Projects',
        help_text=_DETAILED_HELP_TEXT,
        subcommand_help_text={},
    )
Beispiel #9
0
class CommandOptions(HelpProvider):
    """Additional help about contributing code to gsutil."""
    # TODO: gsutil-beta: Add lint .rc file and linting instructions.

    # Help specification. See help_provider.py for documentation.
    help_spec = HelpProvider.HelpSpec(
        help_name='dev',
        help_name_aliases=[
            'development', 'developer', 'code', 'mods', 'software'
        ],
        help_type='additional_help',
        help_one_line_summary='Contributing Code to gsutil',
        help_text=_DETAILED_HELP_TEXT,
        subcommand_help_text={},
    )
Beispiel #10
0
class CommandOptions(HelpProvider):
    """Additional help about subdirectory handling in gsutil."""

    # Help specification. See help_provider.py for documentation.
    help_spec = HelpProvider.HelpSpec(
        help_name='subdirs',
        help_name_aliases=[
            'dirs', 'directory', 'directories', 'folder', 'folders',
            'hierarchy', 'subdir', 'subdirectory', 'subdirectories'
        ],
        help_type='additional_help',
        help_one_line_summary='How Subdirectories Work',
        help_text=_DETAILED_HELP_TEXT,
        subcommand_help_text={},
    )
Beispiel #11
0
class CommandOptions(HelpProvider):
    """Additional help about technical and billing support."""

    # Help specification. See help_provider.py for documentation.
    help_spec = HelpProvider.HelpSpec(
        help_name='support',
        help_name_aliases=[
            'techsupport', 'tech support', 'technical support', 'billing',
            'faq', 'questions'
        ],
        help_type='additional_help',
        help_one_line_summary='Google Cloud Storage Support',
        help_text=_DETAILED_HELP_TEXT,
        subcommand_help_text={},
    )
class CommandOptions(HelpProvider):
    """Add'l help for customer-supplied and customer-managed encryption keys."""

    # Help specification. See help_provider.py for documentation.
    help_spec = HelpProvider.HelpSpec(
        help_name='encryption',
        help_name_aliases=[
            'cmek',
            'csk',
            'csek',
            'decrypt',
            'decryption',
            'encrypt',
        ],
        help_type='additional_help',
        help_one_line_summary='Using Encryption Keys',
        help_text=_DETAILED_HELP_TEXT,
        subcommand_help_text={},
    )
Beispiel #13
0
  def _LoadHelpMaps(self):
    """Returns tuple of help type and help name.

    help type is a dict with key: help type
                             value: list of HelpProviders
    help name is a dict with key: help command name or alias
                             value: HelpProvider

    Returns:
      (help type, help name)
    """

    # Import all gslib.commands submodules.
    for _, module_name, _ in pkgutil.iter_modules(gslib.commands.__path__):
      __import__('gslib.commands.%s' % module_name)
    # Import all gslib.addlhelp submodules.
    for _, module_name, _ in pkgutil.iter_modules(gslib.addlhelp.__path__):
      __import__('gslib.addlhelp.%s' % module_name)

    help_type_map = {}
    help_name_map = {}
    for s in gslib.help_provider.ALL_HELP_TYPES:
      help_type_map[s] = []
    # Only include HelpProvider subclasses in the dict.
    for help_prov in itertools.chain(HelpProvider.__subclasses__(),
                                     Command.__subclasses__()):
      if help_prov is Command:
        # Skip the Command base class itself; we just want its subclasses,
        # where the help command text lives (in addition to non-Command
        # HelpProviders, like naming.py).
        continue
      gslib.help_provider.SanityCheck(help_prov, help_name_map)
      help_name_map[help_prov.help_spec.help_name] = help_prov
      for help_name_aliases in help_prov.help_spec.help_name_aliases:
        help_name_map[help_name_aliases] = help_prov
      help_type_map[help_prov.help_spec.help_type].append(help_prov)
    return (help_type_map, help_name_map)
Beispiel #14
0
  def _LoadHelpMaps(self):
    """Returns tuple of help type and help name.

    help type is a dict with key: help type
                             value: list of HelpProviders
    help name is a dict with key: help command name or alias
                             value: HelpProvider

    Returns:
      (help type, help name)
    """

    # Import all gslib.commands submodules.
    for _, module_name, _ in pkgutil.iter_modules(gslib.commands.__path__):
      __import__('gslib.commands.%s' % module_name)
    # Import all gslib.addlhelp submodules.
    for _, module_name, _ in pkgutil.iter_modules(gslib.addlhelp.__path__):
      __import__('gslib.addlhelp.%s' % module_name)

    help_type_map = {}
    help_name_map = {}
    for s in gslib.help_provider.ALL_HELP_TYPES:
      help_type_map[s] = []
    # Only include HelpProvider subclasses in the dict.
    for help_prov in itertools.chain(
        HelpProvider.__subclasses__(), Command.__subclasses__()):
      if help_prov is Command:
        # Skip the Command base class itself; we just want its subclasses,
        # where the help command text lives (in addition to non-Command
        # HelpProviders, like naming.py).
        continue
      gslib.help_provider.SanityCheck(help_prov, help_name_map)
      help_name_map[help_prov.help_spec.help_name] = help_prov
      for help_name_aliases in help_prov.help_spec.help_name_aliases:
        help_name_map[help_name_aliases] = help_prov
      help_type_map[help_prov.help_spec.help_type].append(help_prov)
    return (help_type_map, help_name_map)