feat[flags] Added backup functionality

This commit is contained in:
Judah Sotomayor 2023-12-20 11:38:13 -05:00
parent 62b11f439b
commit b2198bd934
Signed by: judahsotomayor
SSH Key Fingerprint: SHA256:9Dq4ppxhfAjbX+7HLXEt+ROMiIojI6kqQgUyFUJb9lI
4 changed files with 23 additions and 10 deletions

View File

@ -38,9 +38,22 @@
(defparameter *option-setting* (defparameter *option-setting*
(adopt:make-option 'setting (adopt:make-option 'setting
:long "setting" :long "setting"
:parameter "SETTING" :parameter "SETTING"
:help "Add SETTING to the .system file(s)" :help "Add SETTING to the .system file(s)"
:manual "Add SETTING (an expression in the form Option=value) to the .system file being operated on. Multiple SETTINGs can be set by giving this option multiple times. Use 'Option=nil' to revoke a setting." :manual "Add SETTING (an expression in the form Option=value) to the .system file being operated on. Multiple SETTINGs can be set by giving this option multiple times. Use 'Option=nil' to revoke a setting."
:initial-value nil :initial-value nil
:reduce (adopt:flip #'cons))) :reduce (adopt:flip #'cons)))
(defparameter *option-backup*
(adopt:make-option 'backup
:parameter "LOCATION"
:long "backup"
:short #\b
:help "Back up file to LOCATION before editing."
:manual "Back up FILE to LOCATION before editiong. If no LOCATION is given, default to backing up at ./.service-backup"
:initial-value nil
:reduce (lambda (prev new)
(declare (ignore prev))
new)))

View File

@ -36,6 +36,7 @@
(adopt:exit)) (adopt:exit))
(run (first arguments) (run (first arguments)
:direct-settings (gethash 'setting options) :direct-settings (gethash 'setting options)
:secure (gethash 'secure options))) :secure (gethash 'secure options)
:backup (gethash 'backup options)))
(error (c) (error (c)
(adopt:print-error-and-exit c)))) (adopt:print-error-and-exit c))))

View File

@ -33,4 +33,5 @@
*option-help* *option-help*
*option-secure* *option-secure*
*option-version* *option-version*
*option-setting*))) *option-setting*
*option-backup*)))

View File

@ -22,5 +22,3 @@ NewBinding=Yes
[Install] [Install]
Alias=dbus.service Alias=dbus.service
ervice