docs: def topic_command():
      '''command line tool for jps
      '''
      parser = argparse.ArgumentParser(description='json pub/sub tool')
      pub_common_parser = jps.ArgumentParser(subscriber=False, add_help=False)
      sub_common_parser = jps.ArgumentParser(publisher=False, add_help=False)
      command_parsers = parser.add_subparsers(dest='command', help='command')
  
      pub_parser = command_parsers.add_parser(
          'pub', help='publish topic from command line', parents=[pub_common_parser])
      pub_parser.add_argument('topic_name', type=str, help='name of topic')
      pub_parser.add_argument(
          'data', type=str, help='json string data to be published')
      pub_parser.add_argument('--repeat', '-r', help='repeat in hz', type=float)
  
      echo_parser = command_parsers.add_parser(
          'echo', help='show topic data', parents=[sub_common_parser])
      echo_parser.add_argument('topic_name', type=str, help='name of topic')
      echo_parser.add_argument(
          '--num', '-n', help='print N times and exit', type=int,
          default=None)
  
      list_parser = command_parsers.add_parser(
          'list', help='show topic list', parents=[sub_common_parser])
      list_parser.add_argument(
          '--timeout', '-t', help='timeout in sec', type=float,
          default=1.0)
  
      record_parser = command_parsers.add_parser(
          'record', help='record topic data', parents=[sub_common_parser])
      record_parser.add_argument('topic_names', nargs='*',
                                 help='topic names to be recorded', type=str)
      record_parser.add_argument(
          '--file', '-f', help='output file name (default: record.json)',
          type=str, default='record.json')
  
      play_parser = command_parsers.add_parser(
          'play', help='play recorded topic data', parents=[pub_common_parser])
      play_parser.add_argument('file', type=str, help='input file name')
  
      args = parser.parse_args()
  
      if args.command == 'pub':
          pub(args.topic_name, args.data, repeat_rate=args.repeat,
              host=args.host, pub_port=args.publisher_port)
      elif args.command == 'echo':
          echo(args.topic_name, args.num,
               host=args.host, sub_port=args.subscriber_port)
      elif args.command == 'list':
          show_list(args.timeout, host=args.host, sub_port=args.subscriber_port)
      elif args.command == 'record':
          record(args.file, args.topic_names,
                 host=args.host, sub_port=args.subscriber_port)
      elif args.command == 'play':
          play(args.file, host=args.host, pub_port=args.publisher_port)
      else:
          parser.print_help()