show list of attributes values - dossier - console collection manager DIR Log DIR Files DIR Refs DIR Tags DIR README DIR LICENSE --- DIR commit b9634f331f3916bb064b16bddefa64e0486078e7 DIR parent 7ea0cf799e0f6e790535f595fcb3c24951e3b284 HTML Author: Solene Rapenne <solene@perso.pw> Date: Mon, 30 Jul 2018 13:28:07 +0200 show list of attributes values Diffstat: M dossier | 22 ++++++++++++++++++++-- M dossier.1 | 6 +++++- 2 files changed, 25 insertions(+), 3 deletions(-) --- DIR diff --git a/dossier b/dossier @@ -47,6 +47,17 @@ show() { fi } +# displays the list of values per attributes +show_attributes_values() { + cd "$REPO" + for attribute in * + do + printf "%s:\n" $attribute + awk '{ print }' "${attribute}"/* | sort | uniq | sed 's/^/ /' + done + exit 0 +} + # export the data in csv format "data","data","data" # we assume it'll works with the dataset export_csv() { @@ -204,7 +215,7 @@ usage() { ": dossier collections [register path name] [name]" \ "" \ "Show items and display informations about an item" \ - ": dossier show [identifier]" \ + ": dossier show [attributes] [identifier]" \ "" \ "Look at attributes, search items having some values" \ ": dossier search [attribute [value]] ... [attribute [value]] ..." \ @@ -258,7 +269,14 @@ if [ "$1" = "help" ] ; then usage ; fi if [ "$1" = "show" ] then if [ "$#" -eq 1 ]; then show_list ; fi - if [ "$#" -eq 2 ]; then show "$2" ; fi + if [ "$#" -eq 2 ]; then + if [ "$2" = "attributes" ] + then + show_attributes_values + else + show "$2" + fi + fi fi # dealing with attributes DIR diff --git a/dossier.1 b/dossier.1 @@ -19,12 +19,16 @@ allows to manage different collections to not mix everything. .Bl -tag -width Ds .It Nm Cm help Show help -.It Nm Cm show Op item-name +.It Nm Cm show Oo Cm attributes Oc Op item-name the command .Cm show without argument will display the list of items in the current collection. .Pp With the argument +.Cm attributes +it will show the list of known attributes and possibles values currently in use. +.Pp +With the argument .Ar item-name it will show all the attributes known for that item. .It Nm Cm rm Ar item-name