<commit_before>---@module fimbul.ui.cli

-- Standard CLI functions
--

local cli = {}

local repository = require('fimbul.repository')

function cli.standard_args(opts)
   local repo

   if opts['repository'] ~= nil then
      repo = opts['repository']
   else
      repo = '.'
   end

   return repo
end

function cli.open_repository(repo)
   ok, r = pcall(repository.new, repository, repo)
   if not ok then<commit_msg>Move standard parameter handling to CLI<commit_after>---@module fimbul.ui.cli

-- Standard CLI functions
--

local cli = {}

local repository = require('fimbul.repository')
local logger = require('fimbul.logger')

function cli.standard_parameters()
   return
[[
   -g, --game=GAME    Game engine to use
   -v, --verbose      Verbose logging output
   -h, --help             This bogus.
]]
end

function cli.standard_args(opts)
   local game

   game = opts['game'] or 'v35'
   logger.VERBOSE = opts['verbose'] or false

   return game
end

function cli.open_repository(game)
   ok, r = pcall(repository.new, repository, game)
   if not ok then
{'fraction_non_alphanumeric': 0.1174812030075188, 'fraction_numerical': 0.0018796992481203006, 'mean_word_length': 3.127906976744186, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1256050', 'n_tokens_mistral': 348, 'n_tokens_neox': 340, 'n_words': 99}