
___x_cmd_dict__x_cmd_advise_json(){
    ___x_cmd_cmds_cat "$___X_CMD_ROOT_MOD/dict/lib/dict.advise.json"
}

# Section: Life cycle

___x_cmd_dict_new(){
    local O="${O:?list_name}"
    O="${O#@}"
    ___x_cmd_instance_new "dict" "@$O" "$@"
}

___x_cmd_dict_del(){
    if command -v "$O" 1>/dev/null 2>&1; then
        ___x_cmd_dict_free "$@" && unset "$O"
        return
    fi
    printf "%s\n" "No such dict instance: $O" >&2
}

___x_cmd_dict_free(){
    local O="${O:?Please provide dict_name for ___x_cmd_dict_free}"
    ___x_cmd_instance_rm "dict" "$O"
    eval "unset ___X_BASH_DICT_$O"
}

# EndSection

# Section: has is_empty

# 001 for \n
# 002 for "
DICT_SEP="$___X_CMD_LDICT_SEP"              # "$___X_CMD_UNSEENCHAR_003"
DICT_KV_SEP="$___X_CMD_LDICT_KVSEP"         # "$___X_CMD_UNSEENCHAR_004"
DICT_KEYS_SEP="$___X_CMD_UNSEENCHAR_005"

___X_CMD_DICT_SEP="$DICT_SEP"
___X_CMD_DICT_KV_SEP="$DICT_KV_SEP"
___X_CMD_DICT_KEYS_SEP="$DICT_KEYS_SEP"

___x_cmd_dict_has(){
    ___x_cmd_dict_get "$@" > /dev/null
}

___x_cmd_dict_is_empty(){
    [ "$(___x_cmd_dict_size)" -eq 0 ]
}

# EndSection


# Section: json print pprint

___x_cmd_dict_json(){
    ___x_cmd_dict_dump | ___x_cmd_dict_pjson "$@"
}

___x_cmd_dict_dump_json(){
    ___x_cmd_dict_dump | ___x_cmd_dict_pjson
}

___x_cmd_dict_load_json(){
    ___x_cmd_dict_load <<A
$(printf "%s\n" "$1" | ___x_cmd_dict_pjsonparse)
A
}


___x_cmd_dict_print(){
    ___x_cmd_dict_dump | ___x_cmd_dict_pprint "$@"
}


# EndSection
