commit 525a4bcf30826f8d0b59106b380cb0da7ecf1349 Author: timoxa0 Date: Fri Oct 25 16:48:49 2024 +0500 New pc rice diff --git a/completions/lon-tool.fish b/completions/lon-tool.fish new file mode 100644 index 0000000..868f810 --- /dev/null +++ b/completions/lon-tool.fish @@ -0,0 +1,235 @@ +# fish completion for lon-tool -*- shell-script -*- + +function __lon_tool_debug + set -l file "$BASH_COMP_DEBUG_FILE" + if test -n "$file" + echo "$argv" >> $file + end +end + +function __lon_tool_perform_completion + __lon_tool_debug "Starting __lon_tool_perform_completion" + + # Extract all args except the last one + set -l args (commandline -opc) + # Extract the last arg and escape it in case it is a space + set -l lastArg (string escape -- (commandline -ct)) + + __lon_tool_debug "args: $args" + __lon_tool_debug "last arg: $lastArg" + + # Disable ActiveHelp which is not supported for fish shell + set -l requestComp "LON_TOOL_ACTIVE_HELP=0 $args[1] __complete $args[2..-1] $lastArg" + + __lon_tool_debug "Calling $requestComp" + set -l results (eval $requestComp 2> /dev/null) + + # Some programs may output extra empty lines after the directive. + # Let's ignore them or else it will break completion. + # Ref: https://github.com/spf13/cobra/issues/1279 + for line in $results[-1..1] + if test (string trim -- $line) = "" + # Found an empty line, remove it + set results $results[1..-2] + else + # Found non-empty line, we have our proper output + break + end + end + + set -l comps $results[1..-2] + set -l directiveLine $results[-1] + + # For Fish, when completing a flag with an = (e.g., -n=) + # completions must be prefixed with the flag + set -l flagPrefix (string match -r -- '-.*=' "$lastArg") + + __lon_tool_debug "Comps: $comps" + __lon_tool_debug "DirectiveLine: $directiveLine" + __lon_tool_debug "flagPrefix: $flagPrefix" + + for comp in $comps + printf "%s%s\n" "$flagPrefix" "$comp" + end + + printf "%s\n" "$directiveLine" +end + +# this function limits calls to __lon_tool_perform_completion, by caching the result behind $__lon_tool_perform_completion_once_result +function __lon_tool_perform_completion_once + __lon_tool_debug "Starting __lon_tool_perform_completion_once" + + if test -n "$__lon_tool_perform_completion_once_result" + __lon_tool_debug "Seems like a valid result already exists, skipping __lon_tool_perform_completion" + return 0 + end + + set --global __lon_tool_perform_completion_once_result (__lon_tool_perform_completion) + if test -z "$__lon_tool_perform_completion_once_result" + __lon_tool_debug "No completions, probably due to a failure" + return 1 + end + + __lon_tool_debug "Performed completions and set __lon_tool_perform_completion_once_result" + return 0 +end + +# this function is used to clear the $__lon_tool_perform_completion_once_result variable after completions are run +function __lon_tool_clear_perform_completion_once_result + __lon_tool_debug "" + __lon_tool_debug "========= clearing previously set __lon_tool_perform_completion_once_result variable ==========" + set --erase __lon_tool_perform_completion_once_result + __lon_tool_debug "Successfully erased the variable __lon_tool_perform_completion_once_result" +end + +function __lon_tool_requires_order_preservation + __lon_tool_debug "" + __lon_tool_debug "========= checking if order preservation is required ==========" + + __lon_tool_perform_completion_once + if test -z "$__lon_tool_perform_completion_once_result" + __lon_tool_debug "Error determining if order preservation is required" + return 1 + end + + set -l directive (string sub --start 2 $__lon_tool_perform_completion_once_result[-1]) + __lon_tool_debug "Directive is: $directive" + + set -l shellCompDirectiveKeepOrder 32 + set -l keeporder (math (math --scale 0 $directive / $shellCompDirectiveKeepOrder) % 2) + __lon_tool_debug "Keeporder is: $keeporder" + + if test $keeporder -ne 0 + __lon_tool_debug "This does require order preservation" + return 0 + end + + __lon_tool_debug "This doesn't require order preservation" + return 1 +end + + +# This function does two things: +# - Obtain the completions and store them in the global __lon_tool_comp_results +# - Return false if file completion should be performed +function __lon_tool_prepare_completions + __lon_tool_debug "" + __lon_tool_debug "========= starting completion logic ==========" + + # Start fresh + set --erase __lon_tool_comp_results + + __lon_tool_perform_completion_once + __lon_tool_debug "Completion results: $__lon_tool_perform_completion_once_result" + + if test -z "$__lon_tool_perform_completion_once_result" + __lon_tool_debug "No completion, probably due to a failure" + # Might as well do file completion, in case it helps + return 1 + end + + set -l directive (string sub --start 2 $__lon_tool_perform_completion_once_result[-1]) + set --global __lon_tool_comp_results $__lon_tool_perform_completion_once_result[1..-2] + + __lon_tool_debug "Completions are: $__lon_tool_comp_results" + __lon_tool_debug "Directive is: $directive" + + set -l shellCompDirectiveError 1 + set -l shellCompDirectiveNoSpace 2 + set -l shellCompDirectiveNoFileComp 4 + set -l shellCompDirectiveFilterFileExt 8 + set -l shellCompDirectiveFilterDirs 16 + + if test -z "$directive" + set directive 0 + end + + set -l compErr (math (math --scale 0 $directive / $shellCompDirectiveError) % 2) + if test $compErr -eq 1 + __lon_tool_debug "Received error directive: aborting." + # Might as well do file completion, in case it helps + return 1 + end + + set -l filefilter (math (math --scale 0 $directive / $shellCompDirectiveFilterFileExt) % 2) + set -l dirfilter (math (math --scale 0 $directive / $shellCompDirectiveFilterDirs) % 2) + if test $filefilter -eq 1; or test $dirfilter -eq 1 + __lon_tool_debug "File extension filtering or directory filtering not supported" + # Do full file completion instead + return 1 + end + + set -l nospace (math (math --scale 0 $directive / $shellCompDirectiveNoSpace) % 2) + set -l nofiles (math (math --scale 0 $directive / $shellCompDirectiveNoFileComp) % 2) + + __lon_tool_debug "nospace: $nospace, nofiles: $nofiles" + + # If we want to prevent a space, or if file completion is NOT disabled, + # we need to count the number of valid completions. + # To do so, we will filter on prefix as the completions we have received + # may not already be filtered so as to allow fish to match on different + # criteria than the prefix. + if test $nospace -ne 0; or test $nofiles -eq 0 + set -l prefix (commandline -t | string escape --style=regex) + __lon_tool_debug "prefix: $prefix" + + set -l completions (string match -r -- "^$prefix.*" $__lon_tool_comp_results) + set --global __lon_tool_comp_results $completions + __lon_tool_debug "Filtered completions are: $__lon_tool_comp_results" + + # Important not to quote the variable for count to work + set -l numComps (count $__lon_tool_comp_results) + __lon_tool_debug "numComps: $numComps" + + if test $numComps -eq 1; and test $nospace -ne 0 + # We must first split on \t to get rid of the descriptions to be + # able to check what the actual completion will be. + # We don't need descriptions anyway since there is only a single + # real completion which the shell will expand immediately. + set -l split (string split --max 1 \t $__lon_tool_comp_results[1]) + + # Fish won't add a space if the completion ends with any + # of the following characters: @=/:., + set -l lastChar (string sub -s -1 -- $split) + if not string match -r -q "[@=/:.,]" -- "$lastChar" + # In other cases, to support the "nospace" directive we trick the shell + # by outputting an extra, longer completion. + __lon_tool_debug "Adding second completion to perform nospace directive" + set --global __lon_tool_comp_results $split[1] $split[1]. + __lon_tool_debug "Completions are now: $__lon_tool_comp_results" + end + end + + if test $numComps -eq 0; and test $nofiles -eq 0 + # To be consistent with bash and zsh, we only trigger file + # completion when there are no other completions + __lon_tool_debug "Requesting file completion" + return 1 + end + end + + return 0 +end + +# Since Fish completions are only loaded once the user triggers them, we trigger them ourselves +# so we can properly delete any completions provided by another script. +# Only do this if the program can be found, or else fish may print some errors; besides, +# the existing completions will only be loaded if the program can be found. +if type -q "lon-tool" + # The space after the program name is essential to trigger completion for the program + # and not completion of the program name itself. + # Also, we use '> /dev/null 2>&1' since '&>' is not supported in older versions of fish. + complete --do-complete "lon-tool " > /dev/null 2>&1 +end + +# Remove any pre-existing completions for the program since we will be handling all of them. +complete -c lon-tool -e + +# this will get called after the two calls below and clear the $__lon_tool_perform_completion_once_result global +complete -c lon-tool -n '__lon_tool_clear_perform_completion_once_result' +# The call to __lon_tool_prepare_completions will setup __lon_tool_comp_results +# which provides the program's completion choices. +# If this doesn't require order preservation, we don't use the -k flag +complete -c lon-tool -n 'not __lon_tool_requires_order_preservation && __lon_tool_prepare_completions' -f -a '$__lon_tool_comp_results' +# otherwise we use the -k flag +complete -k -c lon-tool -n '__lon_tool_requires_order_preservation && __lon_tool_prepare_completions' -f -a '$__lon_tool_comp_results' diff --git a/completions/poetry.fish b/completions/poetry.fish new file mode 100644 index 0000000..6f8a493 --- /dev/null +++ b/completions/poetry.fish @@ -0,0 +1,257 @@ +function __fish_poetry_9cf82bc144790825_complete_no_subcommand + for i in (commandline -opc) + if contains -- $i about add build cache check config debug env export help init install list lock new publish remove run search self shell show source update version + return 1 + end + end + return 0 +end + +# global options +complete -c poetry -n '__fish_poetry_9cf82bc144790825_complete_no_subcommand' -l ansi -d 'Force ANSI output.' +complete -c poetry -n '__fish_poetry_9cf82bc144790825_complete_no_subcommand' -l directory -d 'The working directory for the Poetry command (defaults to the current working directory).' +complete -c poetry -n '__fish_poetry_9cf82bc144790825_complete_no_subcommand' -l help -d 'Display help for the given command. When no command is given display help for the list command.' +complete -c poetry -n '__fish_poetry_9cf82bc144790825_complete_no_subcommand' -l no-ansi -d 'Disable ANSI output.' +complete -c poetry -n '__fish_poetry_9cf82bc144790825_complete_no_subcommand' -l no-cache -d 'Disables Poetry source caches.' +complete -c poetry -n '__fish_poetry_9cf82bc144790825_complete_no_subcommand' -l no-interaction -d 'Do not ask any interactive question.' +complete -c poetry -n '__fish_poetry_9cf82bc144790825_complete_no_subcommand' -l no-plugins -d 'Disables plugins.' +complete -c poetry -n '__fish_poetry_9cf82bc144790825_complete_no_subcommand' -l quiet -d 'Do not output any message.' +complete -c poetry -n '__fish_poetry_9cf82bc144790825_complete_no_subcommand' -l verbose -d 'Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug.' +complete -c poetry -n '__fish_poetry_9cf82bc144790825_complete_no_subcommand' -l version -d 'Display this application version.' + +# commands +complete -c poetry -f -n '__fish_poetry_9cf82bc144790825_complete_no_subcommand' -a about -d 'Shows information about Poetry.' +complete -c poetry -f -n '__fish_poetry_9cf82bc144790825_complete_no_subcommand' -a add -d 'Adds a new dependency to pyproject.toml and installs it.' +complete -c poetry -f -n '__fish_poetry_9cf82bc144790825_complete_no_subcommand' -a build -d 'Builds a package, as a tarball and a wheel by default.' +complete -c poetry -f -n '__fish_poetry_9cf82bc144790825_complete_no_subcommand' -a cache +complete -c poetry -f -n '__fish_seen_subcommand_from cache; and not __fish_seen_subcommand_from clear list' -a clear -d 'Clears a Poetry cache by name.' +complete -c poetry -f -n '__fish_seen_subcommand_from cache; and not __fish_seen_subcommand_from clear list' -a list -d 'List Poetry\'s caches.' +complete -c poetry -f -n '__fish_poetry_9cf82bc144790825_complete_no_subcommand' -a check -d 'Validates the content of the pyproject.toml file and its consistency with the poetry.lock file.' +complete -c poetry -f -n '__fish_poetry_9cf82bc144790825_complete_no_subcommand' -a config -d 'Manages configuration settings.' +complete -c poetry -f -n '__fish_poetry_9cf82bc144790825_complete_no_subcommand' -a debug +complete -c poetry -f -n '__fish_seen_subcommand_from debug; and not __fish_seen_subcommand_from info resolve' -a info -d 'Shows debug information.' +complete -c poetry -f -n '__fish_seen_subcommand_from debug; and not __fish_seen_subcommand_from info resolve' -a resolve -d 'Debugs dependency resolution.' +complete -c poetry -f -n '__fish_poetry_9cf82bc144790825_complete_no_subcommand' -a env +complete -c poetry -f -n '__fish_seen_subcommand_from env; and not __fish_seen_subcommand_from info list remove use' -a info -d 'Displays information about the current environment.' +complete -c poetry -f -n '__fish_seen_subcommand_from env; and not __fish_seen_subcommand_from info list remove use' -a list -d 'Lists all virtualenvs associated with the current project.' +complete -c poetry -f -n '__fish_seen_subcommand_from env; and not __fish_seen_subcommand_from info list remove use' -a remove -d 'Remove virtual environments associated with the project.' +complete -c poetry -f -n '__fish_seen_subcommand_from env; and not __fish_seen_subcommand_from info list remove use' -a use -d 'Activates or creates a new virtualenv for the current project.' +complete -c poetry -f -n '__fish_poetry_9cf82bc144790825_complete_no_subcommand' -a export -d 'Exports the lock file to alternative formats.' +complete -c poetry -f -n '__fish_poetry_9cf82bc144790825_complete_no_subcommand' -a help -d 'Displays help for a command.' +complete -c poetry -f -n '__fish_poetry_9cf82bc144790825_complete_no_subcommand' -a init -d 'Creates a basic pyproject.toml file in the current directory.' +complete -c poetry -f -n '__fish_poetry_9cf82bc144790825_complete_no_subcommand' -a install -d 'Installs the project dependencies.' +complete -c poetry -f -n '__fish_poetry_9cf82bc144790825_complete_no_subcommand' -a list -d 'Lists commands.' +complete -c poetry -f -n '__fish_poetry_9cf82bc144790825_complete_no_subcommand' -a lock -d 'Locks the project dependencies.' +complete -c poetry -f -n '__fish_poetry_9cf82bc144790825_complete_no_subcommand' -a new -d 'Creates a new Python project at .' +complete -c poetry -f -n '__fish_poetry_9cf82bc144790825_complete_no_subcommand' -a publish -d 'Publishes a package to a remote repository.' +complete -c poetry -f -n '__fish_poetry_9cf82bc144790825_complete_no_subcommand' -a remove -d 'Removes a package from the project dependencies.' +complete -c poetry -f -n '__fish_poetry_9cf82bc144790825_complete_no_subcommand' -a run -d 'Runs a command in the appropriate environment.' +complete -c poetry -f -n '__fish_poetry_9cf82bc144790825_complete_no_subcommand' -a search -d 'Searches for packages on remote repositories.' +complete -c poetry -f -n '__fish_poetry_9cf82bc144790825_complete_no_subcommand' -a self +complete -c poetry -f -n '__fish_seen_subcommand_from self; and not __fish_seen_subcommand_from add install lock remove update show' -a add -d 'Add additional packages to Poetry\'s runtime environment.' +complete -c poetry -f -n '__fish_seen_subcommand_from self; and not __fish_seen_subcommand_from add install lock remove update show' -a install -d 'Install locked packages (incl. addons) required by this Poetry installation.' +complete -c poetry -f -n '__fish_seen_subcommand_from self; and not __fish_seen_subcommand_from add install lock remove update show' -a lock -d 'Lock the Poetry installation\'s system requirements.' +complete -c poetry -f -n '__fish_seen_subcommand_from self; and not __fish_seen_subcommand_from add install lock remove update show' -a remove -d 'Remove additional packages from Poetry\'s runtime environment.' +complete -c poetry -f -n '__fish_seen_subcommand_from self; and not __fish_seen_subcommand_from add install lock remove update show' -a show -d 'Show packages from Poetry\'s runtime environment.' +complete -c poetry -f -n '__fish_seen_subcommand_from self; and not __fish_seen_subcommand_from add install lock remove update show' -a plugins -d 'Shows information about the currently installed plugins.' +complete -c poetry -f -n '__fish_seen_subcommand_from self; and not __fish_seen_subcommand_from add install lock remove update show' -a update -d 'Updates Poetry to the latest version.' +complete -c poetry -f -n '__fish_poetry_9cf82bc144790825_complete_no_subcommand' -a shell -d 'Spawns a shell within the virtual environment.' +complete -c poetry -f -n '__fish_poetry_9cf82bc144790825_complete_no_subcommand' -a show -d 'Shows information about packages.' +complete -c poetry -f -n '__fish_poetry_9cf82bc144790825_complete_no_subcommand' -a source +complete -c poetry -f -n '__fish_seen_subcommand_from source; and not __fish_seen_subcommand_from add remove show' -a add -d 'Add source configuration for project.' +complete -c poetry -f -n '__fish_seen_subcommand_from source; and not __fish_seen_subcommand_from add remove show' -a remove -d 'Remove source configured for the project.' +complete -c poetry -f -n '__fish_seen_subcommand_from source; and not __fish_seen_subcommand_from add remove show' -a show -d 'Show information about sources configured for the project.' +complete -c poetry -f -n '__fish_poetry_9cf82bc144790825_complete_no_subcommand' -a update -d 'Update the dependencies as according to the pyproject.toml file.' +complete -c poetry -f -n '__fish_poetry_9cf82bc144790825_complete_no_subcommand' -a version -d 'Shows the version of the project or bumps it when a valid bump rule is provided.' + +# command options + +# about + +# add +complete -c poetry -n '__fish_seen_subcommand_from add' -l allow-prereleases -d 'Accept prereleases.' +complete -c poetry -n '__fish_seen_subcommand_from add' -l dev -d 'Add as a development dependency. (Deprecated) Use --group=dev instead.' +complete -c poetry -n '__fish_seen_subcommand_from add' -l dry-run -d 'Output the operations but do not execute anything (implicitly enables --verbose).' +complete -c poetry -n '__fish_seen_subcommand_from add' -l editable -d 'Add vcs/path dependencies as editable.' +complete -c poetry -n '__fish_seen_subcommand_from add' -l extras -d 'Extras to activate for the dependency.' +complete -c poetry -n '__fish_seen_subcommand_from add' -l group -d 'The group to add the dependency to.' +complete -c poetry -n '__fish_seen_subcommand_from add' -l lock -d 'Do not perform operations (only update the lockfile).' +complete -c poetry -n '__fish_seen_subcommand_from add' -l optional -d 'Add as an optional dependency.' +complete -c poetry -n '__fish_seen_subcommand_from add' -l platform -d 'Platforms for which the dependency must be installed.' +complete -c poetry -n '__fish_seen_subcommand_from add' -l python -d 'Python version for which the dependency must be installed.' +complete -c poetry -n '__fish_seen_subcommand_from add' -l source -d 'Name of the source to use to install the package.' + +# build +complete -c poetry -n '__fish_seen_subcommand_from build' -l format -d 'Limit the format to either sdist or wheel.' +complete -c poetry -n '__fish_seen_subcommand_from build' -l output -d 'Set output directory for build artifacts. Default is `dist`.' + +# cache clear +complete -c poetry -n '__fish_seen_subcommand_from cache; and __fish_seen_subcommand_from clear' -l all -d 'Clear all entries in the cache.' + +# cache list + +# check +complete -c poetry -n '__fish_seen_subcommand_from check' -l lock -d 'Checks that poetry.lock exists for the current version of pyproject.toml.' + +# config +complete -c poetry -n '__fish_seen_subcommand_from config' -l list -d 'List configuration settings.' +complete -c poetry -n '__fish_seen_subcommand_from config' -l local -d 'Set/Get from the project\'s local configuration.' +complete -c poetry -n '__fish_seen_subcommand_from config' -l unset -d 'Unset configuration setting.' + +# debug info + +# debug resolve +complete -c poetry -n '__fish_seen_subcommand_from debug; and __fish_seen_subcommand_from resolve' -l extras -d 'Extras to activate for the dependency.' +complete -c poetry -n '__fish_seen_subcommand_from debug; and __fish_seen_subcommand_from resolve' -l install -d 'Show what would be installed for the current system.' +complete -c poetry -n '__fish_seen_subcommand_from debug; and __fish_seen_subcommand_from resolve' -l python -d 'Python version(s) to use for resolution.' +complete -c poetry -n '__fish_seen_subcommand_from debug; and __fish_seen_subcommand_from resolve' -l tree -d 'Display the dependency tree.' + +# env info +complete -c poetry -n '__fish_seen_subcommand_from env; and __fish_seen_subcommand_from info' -l executable -d 'Only display the environment\'s python executable path.' +complete -c poetry -n '__fish_seen_subcommand_from env; and __fish_seen_subcommand_from info' -l path -d 'Only display the environment\'s path.' + +# env list +complete -c poetry -n '__fish_seen_subcommand_from env; and __fish_seen_subcommand_from list' -l full-path -d 'Output the full paths of the virtualenvs.' + +# env remove +complete -c poetry -n '__fish_seen_subcommand_from env; and __fish_seen_subcommand_from remove' -l all -d 'Remove all managed virtual environments associated with the project.' + +# env use + +# export +complete -c poetry -n '__fish_seen_subcommand_from export' -l all-extras -d 'Include all sets of extra dependencies.' +complete -c poetry -n '__fish_seen_subcommand_from export' -l dev -d 'Include development dependencies. (Deprecated)' +complete -c poetry -n '__fish_seen_subcommand_from export' -l extras -d 'Extra sets of dependencies to include.' +complete -c poetry -n '__fish_seen_subcommand_from export' -l format -d 'Format to export to. Currently, only constraints.txt and requirements.txt are supported.' +complete -c poetry -n '__fish_seen_subcommand_from export' -l only -d 'The only dependency groups to include.' +complete -c poetry -n '__fish_seen_subcommand_from export' -l output -d 'The name of the output file.' +complete -c poetry -n '__fish_seen_subcommand_from export' -l with -d 'The optional dependency groups to include.' +complete -c poetry -n '__fish_seen_subcommand_from export' -l with-credentials -d 'Include credentials for extra indices.' +complete -c poetry -n '__fish_seen_subcommand_from export' -l without -d 'The dependency groups to ignore.' +complete -c poetry -n '__fish_seen_subcommand_from export' -l without-hashes -d 'Exclude hashes from the exported file.' +complete -c poetry -n '__fish_seen_subcommand_from export' -l without-urls -d 'Exclude source repository urls from the exported file.' + +# help + +# init +complete -c poetry -n '__fish_seen_subcommand_from init' -l author -d 'Author name of the package.' +complete -c poetry -n '__fish_seen_subcommand_from init' -l dependency -d 'Package to require, with an optional version constraint, e.g. requests:^2.10.0 or requests=2.11.1.' +complete -c poetry -n '__fish_seen_subcommand_from init' -l description -d 'Description of the package.' +complete -c poetry -n '__fish_seen_subcommand_from init' -l dev-dependency -d 'Package to require for development, with an optional version constraint, e.g. requests:^2.10.0 or requests=2.11.1.' +complete -c poetry -n '__fish_seen_subcommand_from init' -l license -d 'License of the package.' +complete -c poetry -n '__fish_seen_subcommand_from init' -l name -d 'Name of the package.' +complete -c poetry -n '__fish_seen_subcommand_from init' -l python -d 'Compatible Python versions.' + +# install +complete -c poetry -n '__fish_seen_subcommand_from install' -l all-extras -d 'Install all extra dependencies.' +complete -c poetry -n '__fish_seen_subcommand_from install' -l compile -d 'Compile Python source files to bytecode. (This option has no effect if modern-installation is disabled because the old installer always compiles.)' +complete -c poetry -n '__fish_seen_subcommand_from install' -l dry-run -d 'Output the operations but do not execute anything (implicitly enables --verbose).' +complete -c poetry -n '__fish_seen_subcommand_from install' -l extras -d 'Extra sets of dependencies to install.' +complete -c poetry -n '__fish_seen_subcommand_from install' -l no-dev -d 'Do not install the development dependencies. (Deprecated)' +complete -c poetry -n '__fish_seen_subcommand_from install' -l no-directory -d 'Do not install any directory path dependencies; useful to install dependencies without source code, e.g. for caching of Docker layers)' +complete -c poetry -n '__fish_seen_subcommand_from install' -l no-root -d 'Do not install the root package (the current project).' +complete -c poetry -n '__fish_seen_subcommand_from install' -l only -d 'The only dependency groups to include.' +complete -c poetry -n '__fish_seen_subcommand_from install' -l only-root -d 'Exclude all dependencies.' +complete -c poetry -n '__fish_seen_subcommand_from install' -l remove-untracked -d 'Removes packages not present in the lock file. (Deprecated)' +complete -c poetry -n '__fish_seen_subcommand_from install' -l sync -d 'Synchronize the environment with the locked packages and the specified groups.' +complete -c poetry -n '__fish_seen_subcommand_from install' -l with -d 'The optional dependency groups to include.' +complete -c poetry -n '__fish_seen_subcommand_from install' -l without -d 'The dependency groups to ignore.' + +# list + +# lock +complete -c poetry -n '__fish_seen_subcommand_from lock' -l check -d 'Check that the poetry.lock file corresponds to the current version of pyproject.toml. (Deprecated) Use poetry check --lock instead.' +complete -c poetry -n '__fish_seen_subcommand_from lock' -l no-update -d 'Do not update locked versions, only refresh lock file.' + +# new +complete -c poetry -n '__fish_seen_subcommand_from new' -l name -d 'Set the resulting package name.' +complete -c poetry -n '__fish_seen_subcommand_from new' -l readme -d 'Specify the readme file format. Default is md.' +complete -c poetry -n '__fish_seen_subcommand_from new' -l src -d 'Use the src layout for the project.' + +# publish +complete -c poetry -n '__fish_seen_subcommand_from publish' -l build -d 'Build the package before publishing.' +complete -c poetry -n '__fish_seen_subcommand_from publish' -l cert -d 'Certificate authority to access the repository.' +complete -c poetry -n '__fish_seen_subcommand_from publish' -l client-cert -d 'Client certificate to access the repository.' +complete -c poetry -n '__fish_seen_subcommand_from publish' -l dist-dir -d 'Dist directory where built artifact are stored. Default is `dist`.' +complete -c poetry -n '__fish_seen_subcommand_from publish' -l dry-run -d 'Perform all actions except upload the package.' +complete -c poetry -n '__fish_seen_subcommand_from publish' -l password -d 'The password to access the repository.' +complete -c poetry -n '__fish_seen_subcommand_from publish' -l repository -d 'The repository to publish the package to.' +complete -c poetry -n '__fish_seen_subcommand_from publish' -l skip-existing -d 'Ignore errors from files already existing in the repository.' +complete -c poetry -n '__fish_seen_subcommand_from publish' -l username -d 'The username to access the repository.' + +# remove +complete -c poetry -n '__fish_seen_subcommand_from remove' -l dev -d 'Remove a package from the development dependencies. (Deprecated) Use --group=dev instead.' +complete -c poetry -n '__fish_seen_subcommand_from remove' -l dry-run -d 'Output the operations but do not execute anything (implicitly enables --verbose).' +complete -c poetry -n '__fish_seen_subcommand_from remove' -l group -d 'The group to remove the dependency from.' +complete -c poetry -n '__fish_seen_subcommand_from remove' -l lock -d 'Do not perform operations (only update the lockfile).' + +# run + +# search + +# self add +complete -c poetry -n '__fish_seen_subcommand_from self; and __fish_seen_subcommand_from add' -l allow-prereleases -d 'Accept prereleases.' +complete -c poetry -n '__fish_seen_subcommand_from self; and __fish_seen_subcommand_from add' -l dry-run -d 'Output the operations but do not execute anything (implicitly enables --verbose).' +complete -c poetry -n '__fish_seen_subcommand_from self; and __fish_seen_subcommand_from add' -l editable -d 'Add vcs/path dependencies as editable.' +complete -c poetry -n '__fish_seen_subcommand_from self; and __fish_seen_subcommand_from add' -l extras -d 'Extras to activate for the dependency.' +complete -c poetry -n '__fish_seen_subcommand_from self; and __fish_seen_subcommand_from add' -l source -d 'Name of the source to use to install the package.' + +# self install +complete -c poetry -n '__fish_seen_subcommand_from self; and __fish_seen_subcommand_from install' -l dry-run -d 'Output the operations but do not execute anything (implicitly enables --verbose).' +complete -c poetry -n '__fish_seen_subcommand_from self; and __fish_seen_subcommand_from install' -l sync -d 'Synchronize the environment with the locked packages and the specified groups.' + +# self lock +complete -c poetry -n '__fish_seen_subcommand_from self; and __fish_seen_subcommand_from lock' -l check -d 'Check that the poetry.lock file corresponds to the current version of pyproject.toml. (Deprecated) Use poetry check --lock instead.' +complete -c poetry -n '__fish_seen_subcommand_from self; and __fish_seen_subcommand_from lock' -l no-update -d 'Do not update locked versions, only refresh lock file.' + +# self remove +complete -c poetry -n '__fish_seen_subcommand_from self; and __fish_seen_subcommand_from remove' -l dry-run -d 'Output the operations but do not execute anything (implicitly enables --verbose).' + +# self show +complete -c poetry -n '__fish_seen_subcommand_from self; and __fish_seen_subcommand_from show' -l addons -d 'List only add-on packages installed.' +complete -c poetry -n '__fish_seen_subcommand_from self; and __fish_seen_subcommand_from show' -l latest -d 'Show the latest version.' +complete -c poetry -n '__fish_seen_subcommand_from self; and __fish_seen_subcommand_from show' -l outdated -d 'Show the latest version but only for packages that are outdated.' +complete -c poetry -n '__fish_seen_subcommand_from self; and __fish_seen_subcommand_from show' -l tree -d 'List the dependencies as a tree.' + +# self show plugins + +# self update +complete -c poetry -n '__fish_seen_subcommand_from self; and __fish_seen_subcommand_from update' -l dry-run -d 'Output the operations but do not execute anything (implicitly enables --verbose).' +complete -c poetry -n '__fish_seen_subcommand_from self; and __fish_seen_subcommand_from update' -l preview -d 'Allow the installation of pre-release versions.' + +# shell + +# show +complete -c poetry -n '__fish_seen_subcommand_from show' -l all -d 'Show all packages (even those not compatible with current system).' +complete -c poetry -n '__fish_seen_subcommand_from show' -l latest -d 'Show the latest version.' +complete -c poetry -n '__fish_seen_subcommand_from show' -l no-dev -d 'Do not list the development dependencies. (Deprecated)' +complete -c poetry -n '__fish_seen_subcommand_from show' -l only -d 'The only dependency groups to include.' +complete -c poetry -n '__fish_seen_subcommand_from show' -l outdated -d 'Show the latest version but only for packages that are outdated.' +complete -c poetry -n '__fish_seen_subcommand_from show' -l top-level -d 'Show only top-level dependencies.' +complete -c poetry -n '__fish_seen_subcommand_from show' -l tree -d 'List the dependencies as a tree.' +complete -c poetry -n '__fish_seen_subcommand_from show' -l why -d 'When showing the full list, or a --tree for a single package, display whether they are a direct dependency or required by other packages' +complete -c poetry -n '__fish_seen_subcommand_from show' -l with -d 'The optional dependency groups to include.' +complete -c poetry -n '__fish_seen_subcommand_from show' -l without -d 'The dependency groups to ignore.' + +# source add +complete -c poetry -n '__fish_seen_subcommand_from source; and __fish_seen_subcommand_from add' -l default -d 'Set this source as the default (disable PyPI). A default source will also be the fallback source if you add other sources. (Deprecated, use --priority)' +complete -c poetry -n '__fish_seen_subcommand_from source; and __fish_seen_subcommand_from add' -l priority -d 'Set the priority of this source. One of: default, primary, secondary, supplemental, explicit. Defaults to primary.' +complete -c poetry -n '__fish_seen_subcommand_from source; and __fish_seen_subcommand_from add' -l secondary -d 'Set this source as secondary. (Deprecated, use --priority)' + +# source remove + +# source show + +# update +complete -c poetry -n '__fish_seen_subcommand_from update' -l dry-run -d 'Output the operations but do not execute anything (implicitly enables --verbose).' +complete -c poetry -n '__fish_seen_subcommand_from update' -l lock -d 'Do not perform operations (only update the lockfile).' +complete -c poetry -n '__fish_seen_subcommand_from update' -l no-dev -d 'Do not update the development dependencies. (Deprecated)' +complete -c poetry -n '__fish_seen_subcommand_from update' -l only -d 'The only dependency groups to include.' +complete -c poetry -n '__fish_seen_subcommand_from update' -l sync -d 'Synchronize the environment with the locked packages and the specified groups.' +complete -c poetry -n '__fish_seen_subcommand_from update' -l with -d 'The optional dependency groups to include.' +complete -c poetry -n '__fish_seen_subcommand_from update' -l without -d 'The dependency groups to ignore.' + +# version +complete -c poetry -n '__fish_seen_subcommand_from version' -l dry-run -d 'Do not update pyproject.toml file' +complete -c poetry -n '__fish_seen_subcommand_from version' -l next-phase -d 'Increment the phase of the current version' +complete -c poetry -n '__fish_seen_subcommand_from version' -l short -d 'Output the version number only' diff --git a/config.fish b/config.fish new file mode 100644 index 0000000..e1407e2 --- /dev/null +++ b/config.fish @@ -0,0 +1,77 @@ +set fish_greeting "" + +function filesize + for file in $argv + if [ -f "$file" ] + echo "$file: $(stat -c %s "$file" | numfmt --to=iec)" + else + echo "$file: not found" + end + end +end + +function _fetch + # if which pfetch > /dev/null 2>&1 && [ "$VSCODE_INJECTION" != "1" ] + # export PF_INFO="ascii title os host kernel uptime memory de" + # #export PF_ASCII="arch" + # pfetch + # end + if which ufetch > /dev/null 2>&1 && [ "$VSCODE_INJECTION" != "1" ] + ufetch + end +end + +if which pyenv > /dev/null 2>&1 + pyenv init - | source +end + +if [ "$TERM" = "foot" ] || [ "$TERM" = "xterm-kitty" ] + alias ssh="TERM=xterm-256color $(which ssh)" + alias gg="TERM=xterm-256color $(which gg)" +end + +if status is-interactive + bind \cl 'clear; _fetch; commandline -f repaint' + bind \cb btop + bind \cs 'source ~/.config/fish/config.fish' + + if which eza > /dev/null 2>&1 + alias ls="eza --icons=auto" + else if which exa > /dev/null 2>&1 + alias ls="exa --icons=auto" + end + + if which bat > /dev/null 2>&1 + alias cat="bat" + else if which batcat > /dev/null 2>&1 + alias cat="batcat" + end + + if which distrobox-enter > /dev/null 2>&1 + alias denter=distrobox-enter + end + + if which nvim > /dev/null 2>&1 + alias v="nvim" + alias edit="nvim" + alias e="nvim" + alias V="sudoedit" + export EDITOR=nvim + end + + alias cdt="cd (mktemp -d)" + alias ":q"=exit + + if which zoxide > /dev/null 2>&1 + zoxide init --cmd cd fish | source + end + + if [ "$reload" = "" ] + _fetch + end + + export VIRTUAL_ENV_DISABLE_PROMPT=0 + set reload "done" +end + +fish_add_path /home/timoxa0/.spicetify diff --git a/fish_variables b/fish_variables new file mode 100644 index 0000000..ab9e0af --- /dev/null +++ b/fish_variables @@ -0,0 +1,78 @@ +# This file contains fish universal variable definitions. +# VERSION: 3.0 +SETUVAR __fish_initialized:3400 +SETUVAR _fisher_upgraded_to_4_4:\x1d +SETUVAR fish_color_autosuggestion:brblack +SETUVAR fish_color_cancel:\x2dr +SETUVAR fish_color_command:blue +SETUVAR fish_color_comment:red +SETUVAR fish_color_cwd:green +SETUVAR fish_color_cwd_root:red +SETUVAR fish_color_end:green +SETUVAR fish_color_error:brred +SETUVAR fish_color_escape:brcyan +SETUVAR fish_color_history_current:\x2d\x2dbold +SETUVAR fish_color_host:normal +SETUVAR fish_color_host_remote:yellow +SETUVAR fish_color_normal:normal +SETUVAR fish_color_operator:brcyan +SETUVAR fish_color_param:cyan +SETUVAR fish_color_quote:yellow +SETUVAR fish_color_redirection:cyan\x1e\x2d\x2dbold +SETUVAR fish_color_search_match:bryellow\x1e\x2d\x2dbackground\x3dbrblack +SETUVAR fish_color_selection:white\x1e\x2d\x2dbold\x1e\x2d\x2dbackground\x3dbrblack +SETUVAR fish_color_status:red +SETUVAR fish_color_user:brgreen +SETUVAR fish_color_valid_path:\x2d\x2dunderline +SETUVAR fish_key_bindings:fish_default_key_bindings +SETUVAR fish_pager_color_completion:normal +SETUVAR fish_pager_color_description:yellow\x1e\x2di +SETUVAR fish_pager_color_prefix:normal\x1e\x2d\x2dbold\x1e\x2d\x2dunderline +SETUVAR fish_pager_color_progress:brwhite\x1e\x2d\x2dbackground\x3dcyan +SETUVAR fish_pager_color_selected_background:\x2dr +SETUVAR fish_user_paths:/home/timoxa0/\x2espicetify\x1e/home/timoxa0/\x2econfig/hypr/bin\x1e/home/timoxa0/\x2elocal/bin +SETUVAR pure_begin_prompt_with_current_directory:true +SETUVAR pure_check_for_new_release:false +SETUVAR pure_color_at_sign:pure_color_mute +SETUVAR pure_color_command_duration:pure_color_warning +SETUVAR pure_color_current_directory:pure_color_primary +SETUVAR pure_color_danger:red +SETUVAR pure_color_dark:black +SETUVAR pure_color_git_branch:pure_color_mute +SETUVAR pure_color_git_dirty:pure_color_mute +SETUVAR pure_color_git_stash:pure_color_info +SETUVAR pure_color_git_unpulled_commits:pure_color_info +SETUVAR pure_color_git_unpushed_commits:pure_color_info +SETUVAR pure_color_hostname:pure_color_mute +SETUVAR pure_color_info:cyan +SETUVAR pure_color_jobs:pure_color_normal +SETUVAR pure_color_light:white +SETUVAR pure_color_mute:brblack +SETUVAR pure_color_normal:normal +SETUVAR pure_color_prefix_root_prompt:pure_color_danger +SETUVAR pure_color_primary:blue +SETUVAR pure_color_prompt_on_error:pure_color_danger +SETUVAR pure_color_prompt_on_success:pure_color_success +SETUVAR pure_color_success:magenta +SETUVAR pure_color_system_time:pure_color_mute +SETUVAR pure_color_username_normal:pure_color_mute +SETUVAR pure_color_username_root:pure_color_light +SETUVAR pure_color_virtualenv:pure_color_mute +SETUVAR pure_color_warning:yellow +SETUVAR pure_enable_git:true +SETUVAR pure_enable_single_line_prompt:false +SETUVAR pure_reverse_prompt_symbol_in_vimode:true +SETUVAR pure_separate_prompt_on_error:false +SETUVAR pure_show_jobs:false +SETUVAR pure_show_prefix_root_prompt:false +SETUVAR pure_show_subsecond_command_duration:false +SETUVAR pure_show_system_time:false +SETUVAR pure_symbol_git_dirty:\x2a +SETUVAR pure_symbol_git_stash:\u2261 +SETUVAR pure_symbol_git_unpulled_commits:\u21e3 +SETUVAR pure_symbol_git_unpushed_commits:\u21e1 +SETUVAR pure_symbol_prefix_root_prompt:\x23 +SETUVAR pure_symbol_prompt:\u276f +SETUVAR pure_symbol_reverse_prompt:\u276e +SETUVAR pure_symbol_title_bar_separator:\x2d +SETUVAR pure_threshold_command_duration:5 diff --git a/functions/fish_prompt.fish b/functions/fish_prompt.fish new file mode 100644 index 0000000..cf00f7c --- /dev/null +++ b/functions/fish_prompt.fish @@ -0,0 +1,34 @@ +# name: Default +# author: Lily Ballard + +function fish_prompt --description 'Write out the prompt' + set -l last_pipestatus $pipestatus + set -lx __fish_last_status $status # Export for __fish_print_pipestatus. + set -l normal (set_color normal) + set -q fish_color_status + or set -g fish_color_status red + + # Color the prompt differently when we're root + set -l color_cwd $fish_color_cwd + set -l suffix '>' + if functions -q fish_is_root_user; and fish_is_root_user + if set -q fish_color_cwd_root + set color_cwd $fish_color_cwd_root + end + set suffix '#' + end + + # Write pipestatus + # If the status was carried over (if no command is issued or if `set` leaves the status untouched), don't bold it. + set -l bold_flag --bold + set -q __fish_prompt_status_generation; or set -g __fish_prompt_status_generation $status_generation + if test $__fish_prompt_status_generation = $status_generation + set bold_flag + end + set __fish_prompt_status_generation $status_generation + set -l status_color (set_color $fish_color_status) + set -l statusb_color (set_color $bold_flag $fish_color_status) + set -l prompt_status (__fish_print_pipestatus "[" "]" "|" "$status_color" "$statusb_color" $last_pipestatus) + + echo -n -s (prompt_login)' ' (set_color $color_cwd) (prompt_pwd) $normal (fish_vcs_prompt) $normal " "$prompt_status $suffix " " +end diff --git a/functions/fish_right_prompt.fish b/functions/fish_right_prompt.fish new file mode 100644 index 0000000..398ca44 --- /dev/null +++ b/functions/fish_right_prompt.fish @@ -0,0 +1,6 @@ +function fish_right_prompt -d "Write out the right prompt" + if set -q CONTAINER_ID + set distrobox_prefix " $(string replace -r -a '\b([\w])' '\U$0' "$CONTAINER_ID") " + end + echo -n -s $distrobox_prefix +end