(command)
return 'command'
r"""Craft a simple command name from the command.

  The best command strings for this are going to be those where a simple
  command was given; we will use the command to derive the name.

  We won't always be able to figure something out and the caller should just
  specify a "--name" on the command-line.

  For example, commands like "export VAR=val\necho ${VAR}", this function would
  return "export".

  If the command starts space or a comment, then we'll skip to the first code
  we can find.

  If we find nothing, just return "command".

  >>> _name_for_command('samtools index "${BAM}"')
  'samtools'
  >>> _name_for_command('/usr/bin/sort "${INFILE}" > "${OUTFILE}"')
  'sort'
  >>> _name_for_command('# This should be ignored')
  'command'
  >>> _name_for_command('\\\n\\\n# Bad continuations, but ignore.\necho hello.')
  'echo'
  >>> _name_for_command('(uname -a && pwd) # Command begins with non-letter.')
  'uname'
  >>> _name_for_command('my-program.sh # Command with hyphens.')
  'my-program.sh'
  >>> _name_for_command('/home/user/bin/-my-sort # Path with hyphen.')
  'my-sort'

  Arguments:
    command: the user-provided command
  Returns:
    a proposed name for the task.
r"""Craft a simple command name from the command.
r Craft a simple command name from the command .
def _name_for_command(command):
  r"""Craft a simple command name from the command.

  The best command strings for this are going to be those where a simple
  command was given; we will use the command to derive the name.

  We won't always be able to figure something out and the caller should just
  specify a "--name" on the command-line.

  For example, commands like "export VAR=val\necho ${VAR}", this function would
  return "export".

  If the command starts space or a comment, then we'll skip to the first code
  we can find.

  If we find nothing, just return "command".

  >>> _name_for_command('samtools index "${BAM}"')
  'samtools'
  >>> _name_for_command('/usr/bin/sort "${INFILE}" > "${OUTFILE}"')
  'sort'
  >>> _name_for_command('# This should be ignored')
  'command'
  >>> _name_for_command('\\\n\\\n# Bad continuations, but ignore.\necho hello.')
  'echo'
  >>> _name_for_command('(uname -a && pwd) # Command begins with non-letter.')
  'uname'
  >>> _name_for_command('my-program.sh # Command with hyphens.')
  'my-program.sh'
  >>> _name_for_command('/home/user/bin/-my-sort # Path with hyphen.')
  'my-sort'

  Arguments:
    command: the user-provided command
  Returns:
    a proposed name for the task.
  """

  lines = command.splitlines()
  for line in lines:
    line = line.strip()
    if line and not line.startswith('#') and line != '\\':
      # Tokenize on whitespace [ \t\n\r\f\v]
      names = re.split(r'\s', line)
      for name in names:
        # Make sure the first character is a letter, number, or underscore
        # Get basename so something like "/usr/bin/sort" becomes just "sort"
        name = re.sub(r'^[^a-zA-Z0-9_]*', '', os.path.basename(name))
        if name:
          return name

  return 'command'
def _name_for_command ( command ) : lines = command . splitlines ( ) for line in lines : line = line . strip ( ) if line and not line . startswith ( '#' ) and line != '\\' : # Tokenize on whitespace [ \t\n\r\f\v] names = re . split ( r'\s' , line ) for name in names : # Make sure the first character is a letter, number, or underscore # Get basename so something like "/usr/bin/sort" becomes just "sort" name = re . sub ( r'^[^a-zA-Z0-9_]*' , '' , os . path . basename ( name ) ) if name : return name return 'command'