halostatue / fish-dict

Dictionary functions for fish shell

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

halostatue/fish-dict

Version

Dictionary functions for fish shell. These functions are based on bash 3 functionality, because fish does not yet support associative arrays.

This has been extracted from halostatue/fish-utils-core because these functions are not core and should be installed on their own.

Note that these functions should only be used when there is no other alternative available, and there's usually an alternative.

Installation

Install with Fisher (recommended):

fisher install halostatue/fish-dict@1.x
Not using a package manager?

Copy functions/*.fish to your fish configuration directory preserving the directory structure.

System Requirements

Functions

dict:* - dict:empty, dict:get, dict:has_key, dict:keys, dict:set

Functions to give fish behaviour similar to associative arrays found in zsh or bash 4. This is based on functions that I wrote for bash 3 and uses the same technique.

dict:set x y          # sets x{y} to an empty value
dict:set x y 1        # sets x{y} to the value 1
dict:set x y 1 2 3    # sets x{y} to the list value 1 2 3
dict:get x y          # gets the value of x{y}
dict:has_key x y      # true if key y exists in dictionary x
dict:empty x          # true if there is no dictionary x
dict:keys x           # the list of all keys in dictionary x
dict:count x          # the number of keys found in dictionary x

Licence

MIT

Change Log

CHANGELOG

Contributing

About

Dictionary functions for fish shell

License:MIT License


Languages

Language:Shell 92.1%Language:Makefile 7.9%