aboutsummaryrefslogtreecommitdiff
path: root/bin/ak-fs
blob: 9ca4e6bdbe0b08ec1c5f58c05a88cab0adeb6688 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/usr/bin/env bash
##
## Tools to add, get and cat files to/from the Arching Kaos File System
##
## Usage:
##
##    -h, --help                                Prints this help message
##    --add, --import <file>                    Adds/Imports a file to the AKFS system
##    --get, --export <hash> <output file>      Exports a file from the AKFS system
##    --cat <hash>                              Concatenates from given hash
##    --list                                    Lists names and roots available
##
fullprogrampath="$(realpath $0)"
PROGRAM=$(basename $0)
descriptionString="AKFS tools"

source $AK_LIBDIR/_ak_log
source $AK_LIBDIR/_ak_script
source $AK_LIBDIR/_ak_fs

if [ ! -z $1 ]
then
    case $1 in
        -h | --help) _ak_usage; exit;;
        --add|--import) _ak_fs_import $2; exit;;
        --get|--export) _ak_fs_export $2 $3; exit;;
        --cat) _ak_fs_cat $2; exit;;
        --net-cat) _ak_fs_net_cat $2; exit;;
        --net-get) _ak_fs_net_get $2; exit;;
        --net-cat-from-map) _ak_fs_net_cat_from_map_hash $2; exit;;
        --net-get-from-map) _ak_fs_net_get_from_map_hash $2; exit;;
        --list) _ak_fs_list; exit;;
        * ) _ak_usage;;
    esac
else
    _ak_usage
fi