<commit_before>﻿module VersionOne.CommandLine

open OAuth2Client

open ArgParse

let await = Async.AwaitTask
let start = Async.StartAsTask

type Options = {
  url     : string
  creds   : string
  secrets : string
  scope   : string
  endpoint : string
  quiet : bool
  outputs : string list
  errors  : string list
  }

let optionDef = {
  Default = { url     = "https://www14.v1host.com/v1sdktesting"
              creds   = "stored_credentials.json"
              secrets = "client_secrets.json"
              scope   = "query-api-1.0"
              endpoint = "/query.v1"
              quiet = false
              outputs = []
              errors  = [] }
  Switches = Map [ "-h",       fun   o -> failwith "Would display help here"
                   "-q",       fun   o -> {o with quiet = true} ]
  Values = Map [ "--url",      fun v o -> {o with url = v}
                 "--scope",    fun v o -> {o with scope = v}
                 "--endpoint", fun v o -> {o with endpoint = v}
                 "--creds",    fun v o -> {o with creds = v}
                 "--secrets",  fun v o -> {o with secrets = v} ]
  Other =                      fun v o -> {o with outputs = v::o.outputs}
  Error =                      fun v o -> printfn "WARNING: Ignored argument: %s" v
                                          {o with errors = v::o.errors}
  }

open System<commit_msg>Print warning to stderr instead of stdout<commit_after>﻿module VersionOne.CommandLine

open OAuth2Client

open ArgParse

let await = Async.AwaitTask
let start = Async.StartAsTask

type Options = {
  url     : string
  creds   : string
  secrets : string
  scope   : string
  endpoint : string
  quiet : bool
  outputs : string list
  errors  : string list
  }

let optionDef = {
  Default = { url     = "https://www14.v1host.com/v1sdktesting"
              creds   = "stored_credentials.json"
              secrets = "client_secrets.json"
              scope   = "query-api-1.0"
              endpoint = "/query.v1"
              quiet = false
              outputs = []
              errors  = [] }
  Switches = Map [ "-h",       fun   o -> failwith "Would display help here"
                   "-q",       fun   o -> {o with quiet = true} ]
  Values = Map [ "--url",      fun v o -> {o with url = v}
                 "--scope",    fun v o -> {o with scope = v}
                 "--endpoint", fun v o -> {o with endpoint = v}
                 "--creds",    fun v o -> {o with creds = v}
                 "--secrets",  fun v o -> {o with secrets = v} ]
  Other =                      fun v o -> {o with outputs = v::o.outputs}
  Error =                      fun v o -> eprintfn "WARNING: Ignored argument: %s" v
                                          {o with errors = v::o.errors}
  }

open System
{'fraction_non_alphanumeric': 0.11331649224106821, 'fraction_numerical': 0.00577408877661494, 'mean_word_length': 1.4, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 21, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5406100', 'n_tokens_mistral': 816, 'n_tokens_neox': 805, 'n_words': 269}