code: def main(argv=None):
      
      args = docopt.docopt(__doc__, argv=argv, version=__version__)
      verbose = bool(args['--verbose'])
  
      f_roll = dice.roll
      kwargs = {}
  
      if args['--min']:
          f_roll = dice.roll_min
      elif args['--max']:
          f_roll = dice.roll_max
  
      if args['--max-dice']:
          try:
              kwargs['max_dice'] = int(args['--max-dice'])
          except ValueError:
              print("Invalid value for --max-dice: '%s'" % args['--max-dice'])
              exit(1)
  
      expr = ' '.join(args['<expression>'])
  
      try:
          roll, kwargs = f_roll(expr, raw=True, return_kwargs=True, **kwargs)
  
          if verbose:
              print('Result: ', end='')
  
          print(str(roll.evaluate_cached(**kwargs)))
  
          if verbose:
              print('Breakdown:')
              print(dice.utilities.verbose_print(roll, **kwargs))
      except DiceBaseException as e:
          print('Whoops! Something went wrong:')
          print(e.pretty_print())
          exit(1)
docs: Run roll() from a command line interface