<commit_before># SYNOPSIS
#   Oh My Fish! CLI
#
# ENV
#   OMF_CONFIG    Oh My Fish! configuration
#
# OVERVIEW
#   Provides options to list, download and remove packages, update
#   the framework, create / submit a new package, etc.

set -g OMF_MISSING_ARG   1
set -g OMF_UNKNOWN_OPT   2
set -g OMF_INVALID_ARG   3
set -g OMF_UNKNOWN_ERR   4

function omf::em
  set_color $fish_color_match ^/dev/null; or set_color cyan
end

function omf::dim
  set_color $fish_color_autosuggestion ^/dev/null; or set_color 555
end

function omf::err
  set_color $fish_color_error ^/dev/null; or set_color red --bold
end

function omf::off
  set_color normal
end

function init -a path --on-event init_omf
  autoload $path/cli $path/util
end

function omf -d "Oh My Fish"
  if test (count $argv) -eq 0
    omf.help "main"; and return 0
  else
    if test $argv[-1] = "--help" -a (count $argv) = 2
      omf.help $argv[1..-2]; and return 0
    end
  end

  switch $argv[1]
    case "-v*" "--v*"
      omf.version

    case "q" "query"
      switch (count $argv)
        case 1
          omf.query_env
        case 2
          omf.query_env "$argv[2]"
        case "*"
          echo (omf::err)"Invalid number of arguments"(omf::off) 1^&2
          echo "Usage: $_ "(omf::em)"$argv[1]"(omf::off)" [<variable name>]" 1^&2
          return $OMF_INVALID_ARG
      end

    case "-h*" "--h*" "help"
      if test (count $argv) -eq 1
        omf.help "main"
      else
        omf.help $argv[2]
      end

    case "c" "cd"
      switch (count $argv)
        case 1
          omf.cd
        case 2
          omf.cd $argv[2]
        case "*"
          echo (omf::err)"Invalid number of arguments"(omf::off) 1^&2
          echo "Usage: $_ "(omf::em)"$argv[1]"(omf::off)" <name>" 1^&2
          return $OMF_INVALID_ARG
      end

    case "l" "li" "lis" "lst" "list"
      omf.list_local_packages | column

    case "d" "desc" "describe"
      if test (count $argv) -eq 1
        omf.describe
      else
        omf.describe $argv[2..-1]
      end

    case "i" "install" "get"
      if test (count $argv) -eq 1
        omf.list_db_packages "skip installed packages" | column
      else
        omf.install_package $argv[2..-1]
        refresh
      end

    case "t" "theme"
      if test (count $argv) -eq 1
        set -l theme (cat $OMF_CONFIG/theme)
        set -l regex "[[:<:]]($theme)[[:>:]]"<commit_msg>omf: install without arguments installs bundle<commit_after># SYNOPSIS
#   Oh My Fish! CLI
#
# ENV
#   OMF_CONFIG    Oh My Fish! configuration
#
# OVERVIEW
#   Provides options to list, download and remove packages, update
#   the framework, create / submit a new package, etc.

set -g OMF_MISSING_ARG   1
set -g OMF_UNKNOWN_OPT   2
set -g OMF_INVALID_ARG   3
set -g OMF_UNKNOWN_ERR   4

function omf::em
  set_color $fish_color_match ^/dev/null; or set_color cyan
end

function omf::dim
  set_color $fish_color_autosuggestion ^/dev/null; or set_color 555
end

function omf::err
  set_color $fish_color_error ^/dev/null; or set_color red --bold
end

function omf::off
  set_color normal
end

function init -a path --on-event init_omf
  autoload $path/cli $path/util
end

function omf -d "Oh My Fish"
  if test (count $argv) -eq 0
    omf.help "main"; and return 0
  else
    if test $argv[-1] = "--help" -a (count $argv) = 2
      omf.help $argv[1..-2]; and return 0
    end
  end

  switch $argv[1]
    case "-v*" "--v*"
      omf.version

    case "q" "query"
      switch (count $argv)
        case 1
          omf.query_env
        case 2
          omf.query_env "$argv[2]"
        case "*"
          echo (omf::err)"Invalid number of arguments"(omf::off) 1^&2
          echo "Usage: $_ "(omf::em)"$argv[1]"(omf::off)" [<variable name>]" 1^&2
          return $OMF_INVALID_ARG
      end

    case "-h*" "--h*" "help"
      if test (count $argv) -eq 1
        omf.help "main"
      else
        omf.help $argv[2]
      end

    case "c" "cd"
      switch (count $argv)
        case 1
          omf.cd
        case 2
          omf.cd $argv[2]
        case "*"
          echo (omf::err)"Invalid number of arguments"(omf::off) 1^&2
          echo "Usage: $_ "(omf::em)"$argv[1]"(omf::off)" <name>" 1^&2
          return $OMF_INVALID_ARG
      end

    case "l" "li" "lis" "lst" "list"
      omf.list_local_packages | column

    case "d" "desc" "describe"
      if test (count $argv) -eq 1
        omf.describe
      else
        omf.describe $argv[2..-1]
      end

    case "i" "install" "get"
      if test (count $argv) -eq 1
        omf.install_bundle
      else
        omf.install_package $argv[2..-1]
        refresh
      end

    case "t" "theme"
      if test (count $argv) -eq 1
        set -l theme (cat $OMF_CONFIG/theme)
        set -l regex "[[:<:]]($theme)[[:>:]]"
{'fraction_non_alphanumeric': 0.131766680654637, 'fraction_numerical': 0.01678556441460344, 'mean_word_length': 2.142386288727752, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '2683572', 'n_tokens_mistral': 1806, 'n_tokens_neox': 1727, 'n_words': 524}