diff --git a/debian/changelog b/debian/changelog index 91d4fa9..db0e5ed 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +sapphrc (1.3.0) unstable; urgency=medium + + * codebase overhaul + + -- Penelope Gwen Thu, 30 May 2024 20:57:16 -0600 + sapphrc (1.2.2) unstable; urgency=medium * faulty git logic diff --git a/debian/control b/debian/control index 729ce42..41ab1b1 100644 --- a/debian/control +++ b/debian/control @@ -13,5 +13,5 @@ Architecture: all Multi-Arch: foreign Depends: ${misc:Depends}, git,rsync -Description: dotfiles backup and profiles - +Description: dotfiles backup with profiles + Sapphrc is a dotfiles manager with support for multiple profile and git synchonization diff --git a/debian/install b/debian/install index 41aa780..79bef01 100644 --- a/debian/install +++ b/debian/install @@ -1,4 +1,5 @@ lib/sapphrc/* lib/sapphrc/ usr/bin/* usr/bin/ usr/share/doc/sapphrc/* usr/share/doc/sapphrc/ -lib/sapphrc/* lib/sapphrc/ +etc/bash_completion.d/sapphrc etc/bash_completion.d/ + diff --git a/debian/manpage.1.ex b/debian/manpage.1.ex deleted file mode 100644 index 3131a20..0000000 --- a/debian/manpage.1.ex +++ /dev/null @@ -1,56 +0,0 @@ -.\" Hey, EMACS: -*- nroff -*- -.\" (C) Copyright 2024 Penelope Gwen , -.\" -.\" First parameter, NAME, should be all caps -.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection -.\" other parameters are allowed: see man(7), man(1) -.TH Sapphrc SECTION "March 8 2024" -.\" Please adjust this date whenever revising the manpage. -.\" -.\" Some roff macros, for reference: -.\" .nh disable hyphenation -.\" .hy enable hyphenation -.\" .ad l left justify -.\" .ad b justify to both left and right margins -.\" .nf disable filling -.\" .fi enable filling -.\" .br insert line break -.\" .sp insert n+1 empty lines -.\" for manpage-specific macros, see man(7) -.SH NAME -sapphrc \- program to do something -.SH SYNOPSIS -.B sapphrc -.RI [ options ] " files" ... -.br -.B bar -.RI [ options ] " files" ... -.SH DESCRIPTION -This manual page documents briefly the -.B sapphrc -and -.B bar -commands. -.PP -.\" TeX users may be more comfortable with the \fB\fP and -.\" \fI\fP escape sequences to invode bold face and italics, -.\" respectively. -\fBsapphrc\fP is a program that... -.SH OPTIONS -These programs follow the usual GNU command line syntax, with long -options starting with two dashes ('\-'). -A summary of options is included below. -For a complete description, see the Info files. -.TP -.B \-h, \-\-help -Show summary of options. -.TP -.B \-v, \-\-version -Show version of program. -.SH SEE ALSO -.BR bar (1), -.BR baz (1). -.br -The programs are documented fully by -.IR "The Rise and Fall of a Fooish Bar" , -available via the Info system. diff --git a/debian/manpage.md.ex b/debian/manpage.md.ex deleted file mode 100644 index 2cb0870..0000000 --- a/debian/manpage.md.ex +++ /dev/null @@ -1,134 +0,0 @@ -% sapphrc(SECTION) | User Commands -% -% "March 8 2024" - -[comment]: # The lines above form a Pandoc metadata block. They must be -[comment]: # the first ones in the file. -[comment]: # See https://pandoc.org/MANUAL.html#metadata-blocks for details. - -[comment]: # pandoc -s -f markdown -t man package.md -o package.1 -[comment]: # -[comment]: # A manual page package.1 will be generated. You may view the -[comment]: # manual page with: nroff -man package.1 | less. A typical entry -[comment]: # in a Makefile or Makefile.am is: -[comment]: # -[comment]: # package.1: package.md -[comment]: # pandoc --standalone --from=markdown --to=man $< --output=$@ -[comment]: # -[comment]: # The pandoc binary is found in the pandoc package. Please remember -[comment]: # that if you create the nroff version in one of the debian/rules -[comment]: # file targets, such as build, you will need to include pandoc in -[comment]: # your Build-Depends control field. - -[comment]: # lowdown is a low dependency, lightweight alternative to -[comment]: # pandoc as a markdown to manpage translator. Use with: -[comment]: # -[comment]: # package.1: package.md -[comment]: # lowdown -s -Tman -o $@ $< -[comment]: # -[comment]: # And add lowdown to the Build-Depends control field. - -[comment]: # Remove the lines starting with '[comment]:' in this file in order -[comment]: # to avoid warning messages. - -# NAME - -sapphrc - program to do something - -# SYNOPSIS - -**sapphrc** **-e** _this_ [**\-\-example=that**] [{**-e** | **\-\-example**} _this_] - [{**-e** | **\-\-example**} {_this_ | _that_}] - -**sapphrc** [{**-h** | *\-\-help**} | {**-v** | **\-\-version**}] - -# DESCRIPTION - -This manual page documents briefly the **sapphrc** and **bar** commands. - -This manual page was written for the Debian distribution because the -original program does not have a manual page. Instead, it has documentation -in the GNU info(1) format; see below. - -**sapphrc** is a program that... - -# OPTIONS - -The program follows the usual GNU command line syntax, with long options -starting with two dashes ('-'). A summary of options is included below. For -a complete description, see the **info**(1) files. - -**-e** _this_, **\-\-example=**_that_ -: Does this and that. - -**-h**, **\-\-help** -: Show summary of options. - -**-v**, **\-\-version** -: Show version of program. - -# FILES - -/etc/foo.conf -: The system-wide configuration file to control the behaviour of - sapphrc. See **foo.conf**(5) for further details. - -${HOME}/.foo.conf -: The per-user configuration file to control the behaviour of - sapphrc. See **foo.conf**(5) for further details. - -# ENVIRONMENT - -**FOO_CONF** -: If used, the defined file is used as configuration file (see also - the section called “FILES”). - -# DIAGNOSTICS - -The following diagnostics may be issued on stderr: - -Bad configuration file. Exiting. -: The configuration file seems to contain a broken configuration - line. Use the **\-\-verbose** option, to get more info. - -**sapphrc** provides some return codes, that can be used in scripts: - - Code Diagnostic - 0 Program exited successfully. - 1 The configuration file seems to be broken. - -# BUGS - -The program is currently limited to only work with the foobar library. - -The upstream BTS can be found at http://bugzilla.foo.tld. - -# SEE ALSO - -**bar**(1), **baz**(1), **foo.conf**(5) - -The programs are documented fully by The Rise and Fall of a Fooish Bar -available via the **info**(1) system. - -# AUTHOR - -Penelope Gwen -: Wrote this manpage for the Debian system. - -# COPYRIGHT - -Copyright © 2007 Penelope Gwen - -This manual page was written for the Debian system (and may be used by -others). - -Permission is granted to copy, distribute and/or modify this document under -the terms of the GNU General Public License, Version 2 or (at your option) -any later version published by the Free Software Foundation. - -On Debian systems, the complete text of the GNU General Public License -can be found in /usr/share/common-licenses/GPL. - -[comment]: # Local Variables: -[comment]: # mode: markdown -[comment]: # End: diff --git a/debian/manpage.sgml.ex b/debian/manpage.sgml.ex deleted file mode 100644 index 098d630..0000000 --- a/debian/manpage.sgml.ex +++ /dev/null @@ -1,154 +0,0 @@ - manpage.1'. You may view - the manual page with: 'docbook-to-man manpage.sgml | nroff -man | - less'. A typical entry in a Makefile or Makefile.am is: - -manpage.1: manpage.sgml - docbook-to-man $< > $@ - - - The docbook-to-man binary is found in the docbook-to-man package. - Please remember that if you create the nroff version in one of the - debian/rules file targets (such as build), you will need to include - docbook-to-man in your Build-Depends control field. - - --> - - - FIRSTNAME"> - SURNAME"> - - March 8 2024"> - - SECTION"> - support@pogmom.me"> - - Sapphrc"> - - - Debian"> - GNU"> - GPL"> -]> - - - -
- &dhemail; -
- - &dhfirstname; - &dhsurname; - - - 2003 - &dhusername; - - &dhdate; -
- - &dhucpackage; - - &dhsection; - - - &dhpackage; - - program to do something - - - - &dhpackage; - - - - - - - - DESCRIPTION - - This manual page documents briefly the - &dhpackage; and bar - commands. - - This manual page was written for the &debian; distribution - because the original program does not have a manual page. - Instead, it has documentation in the &gnu; - Info format; see below. - - &dhpackage; is a program that... - - - - OPTIONS - - These programs follow the usual &gnu; command line syntax, - with long options starting with two dashes ('-'). A summary of - options is included below. For a complete description, see the - Info files. - - - - - - - - Show summary of options. - - - - - - - - Show version of program. - - - - - - SEE ALSO - - bar (1), baz (1). - - The programs are documented fully by The Rise and - Fall of a Fooish Bar available via the - Info system. - - - AUTHOR - - This manual page was written by &dhusername; &dhemail; for - the &debian; system (and may be used by others). Permission is - granted to copy, distribute and/or modify this document under - the terms of the &gnu; General Public License, Version 2 any - later version published by the Free Software Foundation. - - - On Debian systems, the complete text of the GNU General Public - License can be found in /usr/share/common-licenses/GPL. - - - -
- - diff --git a/debian/manpage.xml.ex b/debian/manpage.xml.ex deleted file mode 100644 index c1d844a..0000000 --- a/debian/manpage.xml.ex +++ /dev/null @@ -1,291 +0,0 @@ - -.
will be generated. You may view the -manual page with: nroff -man .
| less'. A typical entry -in a Makefile or Makefile.am is: - -DB2MAN = /usr/share/sgml/docbook/stylesheet/xsl/docbook-xsl/manpages/docbook.xsl -XP = xsltproc -''-nonet -''-param man.charmap.use.subset "0" - -manpage.1: manpage.xml - $(XP) $(DB2MAN) $< - -The xsltproc binary is found in the xsltproc package. The XSL files are in -docbook-xsl. A description of the parameters you can use can be found in the -docbook-xsl-doc-* packages. Please remember that if you create the nroff -version in one of the debian/rules file targets (such as build), you will need -to include xsltproc and docbook-xsl in your Build-Depends control field. -Alternatively use the xmlto command/package. That will also automatically -pull in xsltproc and docbook-xsl. - -Notes for using docbook2x: docbook2x-man does not automatically create the -AUTHOR(S) and COPYRIGHT sections. In this case, please add them manually as - ... . - -To disable the automatic creation of the AUTHOR(S) and COPYRIGHT sections -read /usr/share/doc/docbook-xsl/doc/manpages/authors.html. This file can be -found in the docbook-xsl-doc-html package. - -Validation can be done using: `xmllint -''-noout -''-valid manpage.xml` - -General documentation about man-pages and man-page-formatting: -man(1), man(7), http://www.tldp.org/HOWTO/Man-Page/ - ---> - - - - - - - - - - - - - -]> - - - - &dhtitle; - &dhpackage; - - - &dhfirstname; - &dhsurname; - Wrote this manpage for the Debian system. -
- &dhemail; -
-
-
- - 2007 - &dhusername; - - - This manual page was written for the Debian system - (and may be used by others). - Permission is granted to copy, distribute and/or modify this - document under the terms of the GNU General Public License, - Version 2 or (at your option) any later version published by - the Free Software Foundation. - On Debian systems, the complete text of the GNU General Public - License can be found in - /usr/share/common-licenses/GPL. - -
- - &dhucpackage; - &dhsection; - - - &dhpackage; - program to do something - - - - &dhpackage; - - - - - - - - - this - - - - - - - - this - that - - - - - &dhpackage; - - - - - - - - - - - - - - - - - - - DESCRIPTION - This manual page documents briefly the - &dhpackage; and bar - commands. - This manual page was written for the Debian distribution - because the original program does not have a manual page. - Instead, it has documentation in the GNU - info - 1 - format; see below. - &dhpackage; is a program that... - - - OPTIONS - The program follows the usual GNU command line syntax, - with long options starting with two dashes ('-'). A summary of - options is included below. For a complete description, see the - - info - 1 - files. - - - - - - - Does this and that. - - - - - - - Show summary of options. - - - - - - - Show version of program. - - - - - - FILES - - - /etc/foo.conf - - The system-wide configuration file to control the - behaviour of &dhpackage;. See - - foo.conf - 5 - for further details. - - - - ${HOME}/.foo.conf - - The per-user configuration file to control the - behaviour of &dhpackage;. See - - foo.conf - 5 - for further details. - - - - - - ENVIRONMENT - - - FOO_CONF - - If used, the defined file is used as configuration - file (see also ). - - - - - - DIAGNOSTICS - The following diagnostics may be issued - on stderr: - - - Bad configuration file. Exiting. - - The configuration file seems to contain a broken configuration - line. Use the option, to get more info. - - - - - &dhpackage; provides some return codes, that can - be used in scripts: - - Code - Diagnostic - - 0 - Program exited successfully. - - - 1 - The configuration file seems to be broken. - - - - - - BUGS - The program is currently limited to only work - with the foobar library. - The upstreams BTS can be found - at . - - - SEE ALSO - - - bar - 1 - , - baz - 1 - , - foo.conf - 5 - - The programs are documented fully by The Rise and - Fall of a Fooish Bar available via the - info - 1 - system. - -
- diff --git a/debian/postinst.ex b/debian/postinst.ex deleted file mode 100644 index 6bf00a9..0000000 --- a/debian/postinst.ex +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/sh -# postinst script for sapphrc. -# -# See: dh_installdeb(1). - -set -e - -# Summary of how this script can be called: -# * 'configure' -# * 'abort-upgrade' -# * 'abort-remove' 'in-favour' -# -# * 'abort-remove' -# * 'abort-deconfigure' 'in-favour' -# 'removing' -# -# for details, see https://www.debian.org/doc/debian-policy/ or -# the debian-policy package. - - -case "$1" in - configure) - ;; - - abort-upgrade|abort-remove|abort-deconfigure) - ;; - - *) - echo "postinst called with unknown argument '$1'" >&2 - exit 1 - ;; -esac - -# dh_installdeb will replace this with shell code automatically -# generated by other debhelper scripts. - -#DEBHELPER# - -exit 0 diff --git a/debian/postrm.ex b/debian/postrm.ex deleted file mode 100644 index a5ae940..0000000 --- a/debian/postrm.ex +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/sh -# postrm script for sapphrc. -# -# See: dh_installdeb(1). - -set -e - -# Summary of how this script can be called: -# * 'remove' -# * 'purge' -# * 'upgrade' -# * 'failed-upgrade' -# * 'abort-install' -# * 'abort-install' -# * 'abort-upgrade' -# * 'disappear' -# -# for details, see https://www.debian.org/doc/debian-policy/ or -# the debian-policy package. - - -case "$1" in - purge|remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) - ;; - - *) - echo "postrm called with unknown argument '$1'" >&2 - exit 1 - ;; -esac - -# dh_installdeb will replace this with shell code automatically -# generated by other debhelper scripts. - -#DEBHELPER# - -exit 0 diff --git a/debian/preinst.ex b/debian/preinst.ex deleted file mode 100644 index a46880b..0000000 --- a/debian/preinst.ex +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/sh -# preinst script for sapphrc. -# -# See: dh_installdeb(1). - -set -e - -# Summary of how this script can be called: -# * 'install' -# * 'install' -# * 'upgrade' -# * 'abort-upgrade' -# for details, see https://www.debian.org/doc/debian-policy/ or -# the debian-policy package. - - -case "$1" in - install|upgrade) - ;; - - abort-upgrade) - ;; - - *) - echo "preinst called with unknown argument '$1'" >&2 - exit 1 - ;; -esac - -# dh_installdeb will replace this with shell code automatically -# generated by other debhelper scripts. - -#DEBHELPER# - -exit 0 diff --git a/debian/prerm.ex b/debian/prerm.ex deleted file mode 100644 index 50e5463..0000000 --- a/debian/prerm.ex +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/sh -# prerm script for sapphrc. -# -# See: dh_installdeb(1). - -set -e - -# Summary of how this script can be called: -# * 'remove' -# * 'upgrade' -# * 'failed-upgrade' -# * 'remove' 'in-favour' -# * 'deconfigure' 'in-favour' -# 'removing' -# -# for details, see https://www.debian.org/doc/debian-policy/ or -# the debian-policy package. - - -case "$1" in - remove|upgrade|deconfigure) - ;; - - failed-upgrade) - ;; - - *) - echo "prerm called with unknown argument '$1'" >&2 - exit 1 - ;; -esac - -# dh_installdeb will replace this with shell code automatically -# generated by other debhelper scripts. - -#DEBHELPER# - -exit 0 diff --git a/debian/salsa-ci.yml.ex b/debian/salsa-ci.yml.ex deleted file mode 100644 index 11a64c6..0000000 --- a/debian/salsa-ci.yml.ex +++ /dev/null @@ -1,10 +0,0 @@ -# For more information on what jobs are run see: -# https://salsa.debian.org/salsa-ci-team/pipeline -# -# To enable the jobs, go to your repository (at salsa.debian.org) -# and click over Settings > CI/CD > Expand (in General pipelines). -# In "CI/CD configuration file" write debian/salsa-ci.yml and click -# in "Save Changes". The CI tests will run after the next commit. ---- -include: - - https://salsa.debian.org/salsa-ci-team/pipeline/raw/master/recipes/debian.yml diff --git a/debian/sapphrc.cron.d.ex b/debian/sapphrc.cron.d.ex deleted file mode 100644 index efb35fb..0000000 --- a/debian/sapphrc.cron.d.ex +++ /dev/null @@ -1,4 +0,0 @@ -# -# Regular cron jobs for the sapphrc package. -# -0 4 * * * root [ -x /usr/bin/sapphrc_maintenance ] && /usr/bin/sapphrc_maintenance diff --git a/debian/sapphrc.doc-base.ex b/debian/sapphrc.doc-base.ex deleted file mode 100644 index b657b32..0000000 --- a/debian/sapphrc.doc-base.ex +++ /dev/null @@ -1,20 +0,0 @@ -Document: sapphrc -Title: Debian sapphrc Manual -Author: -Abstract: This manual describes what sapphrc is - and how it can be used to - manage online manuals on Debian systems. -Section: unknown - -Format: debiandoc-sgml -Files: /usr/share/doc/sapphrc/sapphrc.sgml.gz - -Format: postscript -Files: /usr/share/doc/sapphrc/sapphrc.ps.gz - -Format: text -Files: /usr/share/doc/sapphrc/sapphrc.text.gz - -Format: HTML -Index: /usr/share/doc/sapphrc/html/index.html -Files: /usr/share/doc/sapphrc/html/*.html diff --git a/etc/bash_completion.d/sapphrc b/etc/bash_completion.d/sapphrc new file mode 100644 index 0000000..8ff5875 --- /dev/null +++ b/etc/bash_completion.d/sapphrc @@ -0,0 +1,20 @@ +#/usr/bin/env bash + +_sapphrc(){ + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + if [[ ${prev} == sapphrc ]]; then + COMPREPLY=( $(compgen -W "setup profile backup restore sync include exclude" -- ${cur}) ) + return 0 + elif [[ ${prev} == *clude ]]; then + COMPREPLY=( $(compgen -W "add remove" -- ${cur}) ) + elif [[ ${prev} == profile ]]; then + COMPREPLY=( $(compgen -W "create remove join leave list" -- ${cur}) ) + elif [[ ${prev} == -p ]] || [[ ${prev} == leave ]] || [[ ${prev} == join ]] || [[ ${prev} == remove ]]; then + COMPREPLY=( $(compgen -W "$(ls ~/.config/sapphrc/backups)" -- ${cur}) ) + elif [[ ${prev} == add ]]; then + COMPREPLY=( $(compgen -f ${cur}) ) + fi +} +complete -F _sapphrc sapphrc diff --git a/lib/sapphrc/sapphrc-filelists b/lib/sapphrc/sapphrc-filelists new file mode 100644 index 0000000..4948e4f --- /dev/null +++ b/lib/sapphrc/sapphrc-filelists @@ -0,0 +1,95 @@ +#!/bin/bash + +sapphrc_addfile(){ + [ ${#@} -eq 0 ] && echo "No files selected" && exit 1 + for file in "$@";do + fullpath=$(realpath "${file}") + if ! [[ "$fullpath" =~ ^"$HOME/".* ]];then + echo "file not in home dir" + break + fi + if ! [[ -d "$file" || -f "$file" ]];then + echo "file does not exist" + break + fi + filelist+=(${fullpath#$HOME/}) + done + + for e in ${filelist[@]};do + echo $e + done + + read -p "${bold}Add the listed files/directories to profile '${PROFILE_NAME}'?${normal} (Y/n)" yn + if ! [[ "${yn}" =~ ^([nN][oO]|[nN])$ ]];then + for e in ${filelist[@]};do + if grep -q ^"${e}"$ "${sapphrc_config}/backups/${PROFILE_NAME}/${inex}";then + echo "already in file" + else + echo $e|tee -a "${sapphrc_config}/backups/${PROFILE_NAME}/${inex}" >/dev/null + fi + done + fi +} + +sapphrc_rmfile(){ + i=0 + while read line; do + rmfiles+=("$i");i=$(($i+1)) + rmfiles+=("$line") + rmfiles+=("$line") + done < "${sapphrc_config}/backups/${PROFILE_NAME}/${inex}" + [ ${#rmfiles[@]} -eq 0 ] && echo "No files in list" && exit 1 + choices=($(dialog --checklist --output-fd 1 "Select options:" 0 0 0 "${rmfiles[@]}")) + if [ $? -ne 0 ]; then + echo "User canceled." + exit 1 + fi + + for choice in "${choices[@]}"; do + rmlines="${rmlines}$((${choice}+1))d;" + done + sed -i "${rmlines}" "${sapphrc_config}/backups/${PROFILE_NAME}/${inex}" + echo "Removed ${#choices[@]} paths from ${PROFILE_NAME} ${inex} list" +} + +sapphrc_filelists(){ + case "$1" in + include|exclude) + LIST="$1" + shift 1;; + *) + usage 1;; + esac + + case "$1" in + add|remove) + OPERATION="$1" + shift 1;; + *) + usage 1;; + esac + + while getopts 'hp:' flag; do + case "${flag}" in + p ) shift 2;PROFILE_NAME="${OPTARG}";;& + h ) usage 1 ;; + esac + done + + validate_backupdir + validate_profile "${PROFILE}" + + case "${OPERATION}" in + add) + echo "add" + sapphrc_addfile $@ + ;; + remove) + echo "remove" + sapphrc_rmfile $@ + ;; + *) + usage 1;; + esac + echo "$@" +} diff --git a/lib/sapphrc/sapphrc-functions b/lib/sapphrc/sapphrc-functions index 911e6c1..439a6ca 100644 --- a/lib/sapphrc/sapphrc-functions +++ b/lib/sapphrc/sapphrc-functions @@ -1,12 +1,27 @@ #!/bin/bash +source /lib/sapphrc/sapphrc-font sapphrc_config="$HOME/.config/sapphrc" usage(){ - echo -n "sapphrc " - cat /usr/share/doc/sapphrc/$(basename $0) + echo "sapphrc v${VERSION}" + cat /usr/share/doc/sapphrc/sapphrc + sed -e 's/^/ /' /usr/share/doc/sapphrc/sapphrc_setup + sed -e 's/^/ /' /usr/share/doc/sapphrc/sapphrc_profile + sed -e 's/^/ /' /usr/share/doc/sapphrc/sapphrc_backup + sed -e 's/^/ /' /usr/share/doc/sapphrc/sapphrc_restore + sed -e 's/^/ /' /usr/share/doc/sapphrc/sapphrc_sync + sed -e 's/^/ /' /usr/share/doc/sapphrc/sapphrc_filelists + if [[ "${1}" -eq "1" ]];then + exit 1 + fi } +#usage(){ +# echo -n "sapphrc " +# cat /usr/share/doc/sapphrc/$(basename $0) +#} + check_name(){ if [ -z "${1}" ];then $2 || echo "Profile name cannot be blank" @@ -43,60 +58,6 @@ validate_profile(){ sapphrc_profile_rc="${sapphrc_profile_rcdir}/${profile_name}" } -inex_func(){ - validate_profile "${profile_name}" - [ ${#@} -eq 0 ] && echo "No files selected" && exit 1 - for file in "$@";do - fullpath=$(realpath "${file}") - if ! [[ "$fullpath" =~ ^"$HOME/".* ]];then - echo "file not in home dir" - break - fi - if ! [[ -d "$file" || -f "$file" ]];then - echo "file does not exist" - break - fi - filelist+=(${fullpath#$HOME/}) - done - - for e in ${filelist[@]};do - echo $e - done - - read -p "${bold}Add the listed files/directories to profile '${profile_name}'?${normal} (Y/n)" yn - if ! [[ "${yn}" =~ ^([nN][oO]|[nN])$ ]];then - for e in ${filelist[@]};do - if grep -q ^"${e}"$ "${sapphrc_config}/backups/${profile_name}/${inex}";then - echo "already in file" - else - echo $e|tee -a "${sapphrc_config}/backups/${profile_name}/${inex}" >/dev/null - fi - done - fi -} - -inex_rm(){ - validate_profile "${profile_name}" - i=0 - while read line; do - rmfiles+=("$i");i=$(($i+1)) - rmfiles+=("$line") - rmfiles+=("$line") - done < "${sapphrc_config}/backups/${profile_name}/${inex}" - [ ${#rmfiles[@]} -eq 0 ] && echo "No files in list" && exit 1 - choices=($(dialog --checklist --output-fd 1 "Select options:" 0 0 0 "${rmfiles[@]}")) - if [ $? -ne 0 ]; then - echo "User canceled." - exit 1 - fi - - for choice in "${choices[@]}"; do - rmlines="${rmlines}$((${choice}+1))d;" - done - sed -i "${rmlines}" "${sapphrc_config}/backups/${profile_name}/${inex}" - echo "Removed ${#choices[@]} paths from ${profile_name} ${inex} list" -} - validate_backupdir(){ if [ -d "$HOME/.config/sapphrc/backups/.git" ];then echo "backup folder looks good!" @@ -105,3 +66,159 @@ validate_backupdir(){ exit 1 fi } + +#sapphrc_addfile(){ +# [ ${#@} -eq 0 ] && echo "No files selected" && exit 1 +# for file in "$@";do +# fullpath=$(realpath "${file}") +# if ! [[ "$fullpath" =~ ^"$HOME/".* ]];then +# echo "file not in home dir" +# break +# fi +# if ! [[ -d "$file" || -f "$file" ]];then +# echo "file does not exist" +# break +# fi +# filelist+=(${fullpath#$HOME/}) +# done + +# for e in ${filelist[@]};do +# echo $e +# done + +# read -p "${bold}Add the listed files/directories to profile '${PROFILE_NAME}'?${normal} (Y/n)" yn +# if ! [[ "${yn}" =~ ^([nN][oO]|[nN])$ ]];then +# for e in ${filelist[@]};do +# if grep -q ^"${e}"$ "${sapphrc_config}/backups/${PROFILE_NAME}/${inex}";then +# echo "already in file" +# else +# echo $e|tee -a "${sapphrc_config}/backups/${PROFILE_NAME}/${inex}" >/dev/null +# fi +# done +# fi +#} + +#sapphrc_rmfile(){ +# i=0 +# while read line; do +# rmfiles+=("$i");i=$(($i+1)) +# rmfiles+=("$line") +# rmfiles+=("$line") +# done < "${sapphrc_config}/backups/${PROFILE_NAME}/${inex}" +# [ ${#rmfiles[@]} -eq 0 ] && echo "No files in list" && exit 1 +# choices=($(dialog --checklist --output-fd 1 "Select options:" 0 0 0 "${rmfiles[@]}")) +# if [ $? -ne 0 ]; then +# echo "User canceled." +# exit 1 +# fi + +# for choice in "${choices[@]}"; do +# rmlines="${rmlines}$((${choice}+1))d;" +# done +# sed -i "${rmlines}" "${sapphrc_config}/backups/${PROFILE_NAME}/${inex}" +# echo "Removed ${#choices[@]} paths from ${PROFILE_NAME} ${inex} list" +#} + +#sapphrc_filelists(){ +# case "$1" in +# include|exclude) +# LIST="$1" +# shift 1;; +# *) +# usage 1;; +# esac + +# case "$1" in +# add|remove) +# OPERATION="$1" +# shift 1;; +# *) +# usage 1;; +# esac + +# while getopts 'hp:' flag; do +# case "${flag}" in +# p ) shift 2;PROFILE_NAME="${OPTARG}";;& +# h ) usage 1 ;; +# esac +# done + +# validate_backupdir +# validate_profile "${PROFILE}" + +# case "${OPERATION}" in +# add) +# echo "add" +# sapphrc_addfile $@ +# ;; +# remove) +# echo "remove" +# sapphrc_rmfile $@ +# ;; +# *) +# usage 1;; +# esac +# echo "$@" +#} + +#sapphrc_sync(){ +# validate_backupdir +# sync_direction="$1" +# cat "${sapphrc_config}/active_profiles" | while read profile_name +# do +# backup_homedir="$sapphrc_config/backups/${profile_name}/home" +# include_list="$sapphrc_config/backups/${profile_name}/include" +# exclude_list="$sapphrc_config/backups/${profile_name}/exclude" +# case ${sync_direction} in +# backup) +# echo "backup" +# rsync -arvSH --files-from="${include_list}" --exclude-from="${exclude_list}" --exclude '.config/sapphrc/' "${HOME}" "${backup_homedir}" +# ;; +# restore) +# echo "restore" +# rsync -arvSH --files-from="${include_list}" --exclude-from="${exclude_list}" --exclude '.config/sapphrc/' "${backup_homedir}" "${HOME}" +# ;; +# *) +# echo "unknown sync direction" +# esac +# done +#} + +#sapphrc_backup(){ +# sapphrc_sync backup +# find ${HOME}/.config/sapphrc/backups/ -name *.swp -type f -exec rm {} \; +#} + +#sapphrc_push(){ +# cd "$HOME/.config/sapphrc/backups" +# git add .; +# git add -u; +# git commit -m "New backup `date +'%Y-%m-%d %H:%M:%S'`"; +# git push origin main +#} + +#sapphrc_restore(){ +# validate_backupdir +# cd "$HOME/.config/sapphrc/backups" +# git config pull.rebase false +# git pull --no-edit +# sapphrc_sync restore +#} + +#sapphrc_updown(){ +# validate_backupdir + +# sapphrc_backup + +# cd "$HOME/.config/sapphrc/backups" +# gs="$(git status | grep -i 'modified')" +# git fetch origin +# reslog=$(git log HEAD..origin/main --oneline) + +# if [[ "${reslog}" != "" ]];then +# #remote changes exist +# sapphrc_restore +# fi + +# sapphrc_push +#} diff --git a/usr/bin/sapphrc_profile b/lib/sapphrc/sapphrc-profile old mode 100755 new mode 100644 similarity index 75% rename from usr/bin/sapphrc_profile rename to lib/sapphrc/sapphrc-profile index f077143..8320e3b --- a/usr/bin/sapphrc_profile +++ b/lib/sapphrc/sapphrc-profile @@ -1,13 +1,6 @@ #!/bin/bash -source /lib/sapphrc/sapphrc-functions -source /lib/sapphrc/sapphrc-font - -COMMAND="${1}" - -sapphrc_config="${HOME}/.config/sapphrc" - -create(){ +sapphrc_pcreate(){ mkdir -p "${sapphrc_profile_rcdir}" touch "${sapphrc_profile}/"{include,exclude} echo '#!/bin/bash'|tee "${sapphrc_profile_rc}" > /dev/null @@ -17,7 +10,7 @@ create(){ join "${profile_name}" } -remove(){ +sapphrc_premove(){ echo "WARNING: really remove profile '${profile_name}'?" echo "~${sapphrc_profile#$HOME} and all its contents will be deleted!" read -p "Confirm removal (y/N): " confirm_remove @@ -29,7 +22,7 @@ remove(){ fi } -join(){ +sapphrc_pjoin(){ if grep -q ^"${profile_name}"$ "${sapphrc_config}/active_profiles";then echo "Already joined ${profile_name}, nothing to do." else @@ -38,7 +31,7 @@ join(){ fi } -leave(){ +sapphrc_pleave(){ if grep -q ^"${profile_name}"$ "${sapphrc_config}/active_profiles";then sed -i '/^'"${profile_name}"'$/d' "${sapphrc_config}/active_profiles" [ -e "${HOME}/.sapphrc/${profile_name}" ] && rm "${HOME}/.sapphrc/${profile_name}" @@ -48,27 +41,39 @@ leave(){ fi } -list(){ +sapphrc_plist(){ echo "${bold}Active profiles:${normal}" cat "${sapphrc_config}/active_profiles" echo "${bold}Available profiles:${normal}" ls "${sapphrc_config}/backups/" | cat } -case $COMMAND in - create|remove|join|leave ) - validate_backupdir;shift 1; - validate_profile $@;;& - create ) - create $@;; - remove ) - remove $@;; - join ) - join $@;; - leave ) - leave $@;; - list ) - list;; - *|usage ) - usage;; -esac +sapphrc_profile(){ + PROFILE_ACTION="${1}" + + case "$PROFILE_ACTION" in + create|remove|join|leave) + validate_backupdir + shift 1 + validate_profile $@ + ;;& + create) + sapphrc_pcreate $@ + ;; + remove) + sapphrc_premove $@ + ;; + join) + sapphrc_pjoin $@ + ;; + leave) + sapphrc_pleave $@ + ;; + list) + sapphrc_plist + ;; + *|usage) + usage + ;; + esac +} diff --git a/lib/sapphrc/sapphrc-setup b/lib/sapphrc/sapphrc-setup new file mode 100644 index 0000000..d60b003 --- /dev/null +++ b/lib/sapphrc/sapphrc-setup @@ -0,0 +1,65 @@ +#!/bin/bash +sapphrc_setup(){ + if [ -f "${aspphic_config}/backups/.init_complete" ];then + echo "already setup" + exit 0 + fi + + mkdir -p "${sapphrc_config}" + mkdir -p "${HOME}/.sapphrc" + + while true;do + read -p "pull from an existing backup repo? (y/n) " gitrepo_exists + case $gitrepo_exists in + [Yy] ) + read -p "Enter YOUR git repo url: " git_url + git clone "${git_url}" "${sapphrc_config}/backups" + touch "${sapphrc_config}/backups/.init_complete" + backup_count="0" + backups=($(ls "${sapphrc_config}/backups/")) + for b in ${backups[@]};do + [ -d "${sapphrc_config}/backups/${b}" ] && backup_count=$(($backup_count+1)) + done + + if [[ backup_count -gt 0 ]];then + read -p "Found existing profile(s). Join one? (Y/n) " yn + [[ "${yn}" =~ ^([nN][oO]|[nN])$ ]] || sapphrc profile join + else + sapphrc profile create default + fi + break + ;; + [Nn] ) + mkdir -p "${sapphrc_config}/backups" + cd "${sapphrc_config}/backups" + git init + touch "${sapphrc_config}/backups/.init_complete" + git add . + git commit -m "first commit" + git branch -M main + read -p "Enter YOUR git repo url: " git_url + git remote add origin "${git_url}" + git push -u origin main + break + ;; + esac + done + + sapphrc_bashrc="$(awk '/.sapphrc/,/done/' ~/.bashrc)" + if [[ "${#sapphrc_bashrc}" -eq 0 ]];then + echo "for file in ~/.sapphrc/* ; do" >> $HOME/.bashrc + echo " if [ -f \""'$file'"\" ] ; then" >> $HOME/.bashrc + echo " source \""'$file'"\"" >> $HOME/.bashrc + echo " fi" >> $HOME/.bashrc + echo "done" >> $HOME/.bashrc + fi + + if [ ! "$(crontab -l | grep -i 'sapphrc sync')" ];then + mkdir -p $HOME/.cache/sapphrc/ + crontab -l > $HOME/.cache/sapphrc/crontab + echo '*/15 * * * * sapphrc sync >/dev/null 2>&1' >> $HOME/.cache/sapphrc/crontab + crontab $HOME/.cache/sapphrc/crontab + rm $HOME/.cache/sapphrc/crontab + fi + +} diff --git a/lib/sapphrc/sapphrc-sync b/lib/sapphrc/sapphrc-sync new file mode 100644 index 0000000..23fb124 --- /dev/null +++ b/lib/sapphrc/sapphrc-sync @@ -0,0 +1,68 @@ +#!/bin/bash + +sapphrc_rsync(){ + echo "" +# validate_backupdir + sync_direction="$1" + cat "${sapphrc_config}/active_profiles" | while read profile_name + do + backup_homedir="$sapphrc_config/backups/${profile_name}/home" + include_list="$sapphrc_config/backups/${profile_name}/include" + exclude_list="$sapphrc_config/backups/${profile_name}/exclude" + case ${sync_direction} in + backup) + echo "backup" + rsync -arvSH --files-from="${include_list}" --exclude-from="${exclude_list}" --exclude '.config/sapphrc/' "${HOME}" "${backup_homedir}" + ;; + restore) + echo "restore" + rsync -arvSH --files-from="${include_list}" --exclude-from="${exclude_list}" --exclude '.config/sapphrc/' "${backup_homedir}" "${HOME}" + ;; + *) + echo "unknown sync direction" + esac + done +} + +sapphrc_backup(){ + echo "backing up!" + sapphrc_rsync backup + find ${HOME}/.config/sapphrc/backups/ -name *.swp -type f -exec rm {} \; +} + +sapphrc_push(){ + echo "pushing!" + cd "$HOME/.config/sapphrc/backups" + git add .; + git add -u; + git commit -m "New backup `date +'%Y-%m-%d %H:%M:%S'`"; + git push origin main +} + +sapphrc_restore(){ + echo "restoring!" + validate_backupdir + cd "$HOME/.config/sapphrc/backups" + git config pull.rebase false + git pull --no-edit + sapphrc_rsync restore +} + +sapphrc_sync(){ + echo "syncing!" + validate_backupdir + + sapphrc_backup + + cd "$HOME/.config/sapphrc/backups" + gs="$(git status | grep -i 'modified')" + git fetch origin + reslog=$(git log HEAD..origin/main --oneline) + + if [[ "${reslog}" != "" ]];then + #remote changes exist + sapphrc_restore + fi + + sapphrc_push +} diff --git a/lib/sapphrc/version b/lib/sapphrc/version index 23aa839..f0bb29e 100644 --- a/lib/sapphrc/version +++ b/lib/sapphrc/version @@ -1 +1 @@ -1.2.2 +1.3.0 diff --git a/usr/bin/sapphrc b/usr/bin/sapphrc index 4d85c74..3e6a175 100755 --- a/usr/bin/sapphrc +++ b/usr/bin/sapphrc @@ -1,68 +1,38 @@ #!/bin/bash +source /lib/sapphrc/sapphrc-functions COMMAND="${1}" VERSION=$(cat /lib/sapphrc/version) -setup() { - sapphrc_setup $@ -} - -profile() { - sapphrc_profile $@ -} - -backup() { - sapphrc_backup $@ -} - -restore() { - sapphrc_restore $@ -} - -updown() { - sapphrc_updown $@ -} - -push() { - sapphrc_push $@ -} - -include(){ - sapphrc_include $@ -} - -exclude(){ - sapphrc_exclude $@ -} - -usage() { - echo "Sapphic Package Manager v${VERSION}" - cat /usr/share/doc/sapphrc/sapphrc - sed -e 's/^/ /' /usr/share/doc/sapphrc/sapphrc_setup - sed -e 's/^/ /' /usr/share/doc/sapphrc/sapphrc_profile - sed -e 's/^/ /' /usr/share/doc/sapphrc/sapphrc_backup - sed -e 's/^/ /' /usr/share/doc/sapphrc/sapphrc_restore -} - case $COMMAND in - setup|profile|backup|restore|updown|push|include|exclude ) - shift 1;;& - setup ) - setup $@;; - profile ) - profile $@;; - backup ) - backup $@;; - restore ) - restore $@;; - updown ) - updown $@;; - push ) - push $@;; - include ) - include $@;; - exclude ) - exclude $@;; + setup|profile|backup|restore|sync|include|exclude) + shift 1 + ;;& + setup) + source /lib/sapphrc/sapphrc-setup + sapphrc_setup + ;; + profile) + source /lib/sapphrc/sapphrc-profile + sapphrc_profile $@ + ;; + backup|restore|sync) + source /lib/sapphrc/sapphrc-sync + ;;& + backup) + sapphrc_backup + sapphrc_push + ;; + restore) + sapphrc_restore + ;; + sync) + sapphrc_sync + ;; + include|exclude) + source /lib/sapphrc/sapphrc-filelists + sapphrc_filelists "${COMMAND}" $@ + ;; *|usage ) usage;; esac diff --git a/usr/bin/sapphrc_backup b/usr/bin/sapphrc_backup deleted file mode 100755 index 9f65b1a..0000000 --- a/usr/bin/sapphrc_backup +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash - -source /lib/sapphrc/sapphrc-functions -source /lib/sapphrc/sapphrc-font -validate_backupdir - -sapphrc_config="$HOME/.config/sapphrc" - -cat "${sapphrc_config}/active_profiles" | while read profile_name -do - backup_homedir="$sapphrc_config/backups/${profile_name}/home" - include_list="$sapphrc_config/backups/${profile_name}/include" - exclude_list="$sapphrc_config/backups/${profile_name}/exclude" - echo "${include_list}" - echo "${exclude_list}" - echo "${HOME}" - echo "${backup_homedir}" - rsync -arvSH --files-from="${include_list}" --exclude-from="${exclude_list}" --exclude '.config/sapphrc/' "${HOME}" "${backup_homedir}" -done - -find ${HOME}/.config/sapphrc/backups/ -name *.swp -type f -exec rm {} \; diff --git a/usr/bin/sapphrc_exclude b/usr/bin/sapphrc_exclude deleted file mode 100755 index 861073a..0000000 --- a/usr/bin/sapphrc_exclude +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/bash - -COMMAND=$1 - -source /lib/sapphrc/sapphrc-functions -source /lib/sapphrc/sapphrc-font - -inex="exclude" - -case $COMMAND in - add|remove ) - shift 1;;& - add ) - action="add";; - remove ) - action="remove";; - * ) - usage - exit 1;; -esac - -while getopts 'hp:' flag; do - case "${flag}" in - p ) echo "${OPTARG}";shift 2;profile_name="${OPTARG}";;& - h ) usage;exit 1 ;; - esac -done - -validate_backupdir - -case "${action}" in - add ) - inex_func "$@";; - remove ) - inex_rm "$@";; -esac diff --git a/usr/bin/sapphrc_include b/usr/bin/sapphrc_include deleted file mode 100755 index 7fab557..0000000 --- a/usr/bin/sapphrc_include +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/bash - -COMMAND=$1 - -source /lib/sapphrc/sapphrc-functions -source /lib/sapphrc/sapphrc-font - -inex="include" - -case $COMMAND in - add|remove ) - shift 1;;& - add ) - action="add";; - remove ) - action="remove";; - * ) - usage - exit 1;; -esac - -while getopts 'hp:' flag; do - case "${flag}" in - p ) echo "${OPTARG}";shift 2;profile_name="${OPTARG}";;& - h ) usage;exit 1 ;; - esac -done - -validate_backupdir - -case "${action}" in - add ) - inex_func "$@";; - remove ) - inex_rm "$@";; -esac diff --git a/usr/bin/sapphrc_push b/usr/bin/sapphrc_push deleted file mode 100755 index 444f5fc..0000000 --- a/usr/bin/sapphrc_push +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash - -source /lib/sapphrc/sapphrc-functions -source /lib/sapphrc/sapphrc-font -validate_backupdir - -cd "$HOME/.config/sapphrc/backups" -git add .; -git add -u; -git commit -m "New backup `date +'%Y-%m-%d %H:%M:%S'`"; -git push origin main diff --git a/usr/bin/sapphrc_restore b/usr/bin/sapphrc_restore deleted file mode 100755 index d97e318..0000000 --- a/usr/bin/sapphrc_restore +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash - -source /lib/sapphrc/sapphrc-functions -source /lib/sapphrc/sapphrc-font -validate_backupdir - -cd "$HOME/.config/sapphrc/backups" -git config pull.rebase false -git pull --no-edit - -sapphrc_config="$HOME/.config/sapphrc" - -cat "${sapphrc_config}/active_profiles" | while read profile_name -do - backup_homedir="$sapphrc_config/backups/${profile_name}/home" - include_list="$sapphrc_config/backups/${profile_name}/include" - exclude_list="$sapphrc_config/backups/${profile_name}/exclude" - rsync -arvSH --files-from="${include_list}" --exclude-from="${exclude_list}" --exclude '.config/sapphrc/' "${backup_homedir}" "${HOME}" -done diff --git a/usr/bin/sapphrc_setup b/usr/bin/sapphrc_setup deleted file mode 100755 index bfe2257..0000000 --- a/usr/bin/sapphrc_setup +++ /dev/null @@ -1,65 +0,0 @@ -#!/bin/bash - -sapphrc_config="$HOME/.config/sapphrc" -if [ -f "${aspphic_config}/backups/.init_complete" ];then - echo "already setup" - exit 0 -fi - -mkdir -p "${sapphrc_config}" -mkdir -p "${HOME}/.sapphrc" - -while true;do - read -p "pull from an existing backup repo? (y/n) " gitrepo_exists - case $gitrepo_exists in - [Yy] ) - read -p "Enter YOUR git repo url: " git_url - git clone "${git_url}" "${sapphrc_config}/backups" - touch "${sapphrc_config}/backups/.init_complete" - backup_count="0" - backups=($(ls "${sapphrc_config}/backups/")) - for b in ${backups[@]};do - [ -d "${sapphrc_config}/backups/${b}" ] && backup_count=$(($backup_count+1)) - done - - if [[ backup_count -gt 0 ]];then - read -p "Found existing profile(s). Join one? (Y/n) " yn - [[ "${yn}" =~ ^([nN][oO]|[nN])$ ]] || sapphrc profile join - else - sapphrc profile create default - fi - break - ;; - [Nn] ) - mkdir -p "${sapphrc_config}/backups" - cd "${sapphrc_config}/backups" - git init - touch "${sapphrc_config}/backups/.init_complete" - git add . - git commit -m "first commit" - git branch -M main - read -p "Enter YOUR git repo url: " git_url - git remote add origin "${git_url}" - git push -u origin main - break - ;; - esac -done - -##link ~/.sapphrc/* files to .bashrc -sapphrc_bashrc="$(awk '/.sapphrc/,/done/' ~/.bashrc)" -if [[ "${#sapphrc_bashrc}" -eq 0 ]];then - echo "for file in ~/.sapphrc/* ; do" >> $HOME/.bashrc - echo " if [ -f \""'$file'"\" ] ; then" >> $HOME/.bashrc - echo " source \""'$file'"\"" >> $HOME/.bashrc - echo " fi" >> $HOME/.bashrc - echo "done" >> $HOME/.bashrc -fi - -if [ ! "$(crontab -l | grep -i 'sapphrc_updown')" ];then - mkdir -p $HOME/.cache/sapphrc/ - crontab -l > $HOME/.cache/sapphrc/crontab - echo "*/15 * * * * sapphrc_updown" >> $HOME/.cache/sapphrc/crontab - crontab $HOME/.cache/sapphrc/crontab - rm $HOME/.cache/sapphrc/crontab -fi diff --git a/usr/bin/sapphrc_updown b/usr/bin/sapphrc_updown deleted file mode 100755 index 29948c9..0000000 --- a/usr/bin/sapphrc_updown +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash - -source /lib/sapphrc/sapphrc-functions -source /lib/sapphrc/sapphrc-font -validate_backupdir - -cd "$HOME/.config/sapphrc/backups" -sapphrc_backup -gs="$(git status | grep -i 'modified')" -git fetch origin -reslog=$(git log HEAD..origin/main --oneline) - -if [[ "${reslog}" != "" ]];then -#remote changes exist - sapphrc_restore -fi - sapphrc_push -exit diff --git a/usr/share/doc/sapphrc/sapphrc b/usr/share/doc/sapphrc/sapphrc index 1330ddd..4750146 100644 --- a/usr/share/doc/sapphrc/sapphrc +++ b/usr/share/doc/sapphrc/sapphrc @@ -1,6 +1,6 @@ -Usage: spm command [options] +Usage: sapphrc command [options] -Sapphrc is a dotfiles manager with support for multiple profile and git synchonization +Sapphrc is a dotfiles manager with support for multiple profiles and git synchonization Commands: usage: Print this dialogue diff --git a/usr/share/doc/sapphrc/sapphrc_exclude b/usr/share/doc/sapphrc/sapphrc_exclude deleted file mode 100644 index e0ea58b..0000000 --- a/usr/share/doc/sapphrc/sapphrc_exclude +++ /dev/null @@ -1,3 +0,0 @@ -backup: update profile based on current configuration - usage: - sapphrc exclude [action] (-p ) diff --git a/usr/share/doc/sapphrc/sapphrc_filelists b/usr/share/doc/sapphrc/sapphrc_filelists new file mode 100644 index 0000000..347c5c7 --- /dev/null +++ b/usr/share/doc/sapphrc/sapphrc_filelists @@ -0,0 +1,7 @@ +include/exclude: manage list of files to be included or excluded from a backup, respectively + usage: + sapphrc [include|exclude] add (-p profile_name) /path/to/file /add/multiple/files + sapphrc [include|exclude] remove (-p profile_name) + actions: + add: adds user-defined files/directories to the include/exclude list + remove: prompts user to select which files to remove from the include/exclude list diff --git a/usr/share/doc/sapphrc/sapphrc_include b/usr/share/doc/sapphrc/sapphrc_include deleted file mode 100644 index a1a869c..0000000 --- a/usr/share/doc/sapphrc/sapphrc_include +++ /dev/null @@ -1 +0,0 @@ -include diff --git a/usr/share/doc/sapphrc/sapphrc_profile b/usr/share/doc/sapphrc/sapphrc_profile index f9f7193..466eb36 100644 --- a/usr/share/doc/sapphrc/sapphrc_profile +++ b/usr/share/doc/sapphrc/sapphrc_profile @@ -6,3 +6,4 @@ profile: manage sapphrc profiles remove: leaves and deletes an existing sapphrc profile join: joins an existing sapphrc profile leave: leaves an existing sapphrc profile + list: lists profiles diff --git a/usr/share/doc/sapphrc/sapphrc_setup b/usr/share/doc/sapphrc/sapphrc_setup index e69de29..75770ad 100644 --- a/usr/share/doc/sapphrc/sapphrc_setup +++ b/usr/share/doc/sapphrc/sapphrc_setup @@ -0,0 +1,3 @@ +setup: Initializes sapphrc + usage: + sapphrc setup diff --git a/usr/share/doc/sapphrc/sapphrc_sync b/usr/share/doc/sapphrc/sapphrc_sync new file mode 100644 index 0000000..a067026 --- /dev/null +++ b/usr/share/doc/sapphrc/sapphrc_sync @@ -0,0 +1,3 @@ +sync: Attempts to neatly back up local changes and restore remote changes + usage: + sapphrc sync