<commit_before>require 'optparse'
require_relative '../pandata'

module Pandata

  # Parses command-line input.
  class ArgvParser
    # Prevent instances
    private_class_method :new

    # Takes an ARGV (array) argument.
    #
    # Returns a hash with:
    # - :opts (string: help information)
    # - :user_id (string)
    # - :output_file (string)
    # - :data_to_get (array)
    # - :get_all_data (boolean)
    # - :return_as_json (boolean)
    def self.parse(argv)
      options = { data_to_get: [] }
      get_all_data = false

      options[:opts] = OptionParser.new do |opts|
        opts.banner = 'Pandata: A tool for downloading Pandora.com data (likes, bookmarks, stations, etc.)'
        opts.define_head 'Usage: pandata <email|webname> [options]'
        opts.separator <<-END

Examples:
  pandata <EMAIL> --liked_tracks
  pandata my_webname --all -o my_pandora_data.txt
  pandata my_webname -lLb --json

Options:<commit_msg>Update argv_parser.rb<commit_after>require 'optparse'
require_relative '../pandata'

module Pandata

  # Parses command-line input.
  class ArgvParser
    # Prevent instances
    private_class_method :new

    # Takes an ARGV (array) argument.
    #
    # Returns a hash with:
    # - :opts (OptionParser object)
    # - :user_id (string)
    # - :output_file (string)
    # - :data_to_get (array)
    # - :get_all_data (boolean)
    # - :return_as_json (boolean)
    def self.parse(argv)
      options = { data_to_get: [] }
      get_all_data = false

      options[:opts] = OptionParser.new do |opts|
        opts.banner = 'Pandata: A tool for downloading Pandora.com data (likes, bookmarks, stations, etc.)'
        opts.define_head 'Usage: pandata <email|webname> [options]'
        opts.separator <<-END

Examples:
  pandata <EMAIL> --liked_tracks
  pandata my_webname --all -o my_pandora_data.txt
  pandata my_webname -lLb --json

Options:
{'fraction_non_alphanumeric': 0.11446740858505565, 'fraction_numerical': 0.0, 'mean_word_length': 2.933333333333333, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3070892', 'n_tokens_mistral': 661, 'n_tokens_neox': 644, 'n_words': 161}