@@ -81,7 +81,7 @@ Config:
8181 \$ HEDGEDOC_CONFIG_DIR (defaults to $XDG_CONFIG_HOME /$SCRIPTNAME )
8282 \$ HEDGEDOC_COOKIES_FILE (defaults to \$ HEDGEDOC_CONFIG_DIR/key.conf)
8383
84- Usage examples:
84+ Usage examples:
8585
8686 \$ export HEDGEDOC_SERVER='$HEDGEDOC_SERVER '
8787 \$ export HEDGEDOC_COOKIES_FILE=$HEDGEDOC_COOKIES_FILE
@@ -178,7 +178,7 @@ function import_note() {
178178 echo " Hint: You may need to run '$SCRIPTNAME login' to authenticate first." >&2
179179 return 2
180180 fi
181- echo " $note_id "
181+ echo " $note_id "
182182}
183183
184184function export_note() {
@@ -234,7 +234,7 @@ function export_note() {
234234 output_path=" ${output_path:- $note_id .zip} "
235235 # hack: there is no way to get slide output as zipfile directly.
236236 # we dump it to folder of html files first then zip it.
237-
237+
238238 # check for any existing conflicting file/dir that wget downloads
239239 local temp_folder_name=" $(
240240 echo " $HEDGEDOC_SERVER " \
@@ -285,6 +285,18 @@ function user_login_helper_gitlab() {
285285 local password=$1 ; shift
286286
287287 bash ${HELPER_SCRIPT_DIR} /login-hedgedoc-via-gitlab.sh $username $password >& /dev/null
288+
289+ }
290+
291+ function backup_all_notes() {
292+ output_path=" ${1:- archive.zip} "
293+
294+ curl \
295+ --silent \
296+ --cookie " $HEDGEDOC_COOKIES_FILE " \
297+ --output " $output_path " \
298+ " ${HEDGEDOC_SERVER} /me/export" \
299+ && echo " $output_path "
288300}
289301
290302function user_login() {
@@ -381,7 +393,7 @@ function user_profile() {
381393
382394function user_history() {
383395 assert_is_authenticated
384-
396+
385397 curl \
386398 --silent \
387399 --cookie " $HEDGEDOC_COOKIES_FILE " \
@@ -422,6 +434,9 @@ function main() {
422434 export)
423435 export_note " ${1:- } " " ${2:- } " " ${3:- } "
424436 ;;
437+ backup)
438+ backup_all_notes " ${1:- } "
439+ ;;
425440 delete)
426441 delete_note " ${1:- } "
427442 ;;
@@ -448,7 +463,7 @@ function main() {
448463# Do the usage function of no Command line arguments are given.
449464if [[ $# -eq 0 ]]; then
450465 set -- " help"
451- fi
466+ fi
452467
453468# Allow importing funcs without running main by using `source ./bin/hedgedoc --import`
454469if [[ " ${1:- } " != " --import" ]]; then
0 commit comments