|  |  | @ -1,6 +1,6 @@ | 
			
		
	
		
		
			
				
					
					|  |  |  | #!/bin/sh |  |  |  | #!/bin/sh | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | # Manages dotfiles and packages |  |  |  | # Tracks dotfiles and packages | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | # Depends: GNU getopt, (pacman, pacman-contrib) / (dpkg, apt) |  |  |  | # Depends: GNU getopt, (pacman, pacman-contrib) / (dpkg, apt) | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | # User-config |  |  |  | # User-config | 
			
		
	
	
		
		
			
				
					|  |  | @ -31,48 +31,93 @@ fi | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | help() |  |  |  | help() | 
			
		
	
		
		
			
				
					
					|  |  |  | { |  |  |  | { | 
			
		
	
		
		
			
				
					
					|  |  |  | 	u=$(tput smul) |  |  |  | 	(cat << EOF | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | .TH DOTFILES.SH 1 "2021-08-22" "dotfiles.sh 0.9" "dotfiles.sh Manual" | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 	cat << EOF |  |  |  | 
 | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | ${b}NAME${n} |  |  |  | .SH NAME | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 	dotfiles - manages dotfiles and packages |  |  |  | dotfiles.sh \- config file and package tracking utility | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | ${b}SYNOPSIS${n} |  |  |  | .SH SYNOPSIS | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 	${b}./dotfiles.sh${n} ${u}OPTION${n} [${u}ARG${n}] |  |  |  | .B ./dotfiles.sh | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | .I OPERATION | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | ${b}OPTIONS${n} |  |  |  | .RI [ OPTION ...]\& | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 	${b}-a${n} ${u}FILE${n}, ${b}--add${n}=${u}FILE${n} |  |  |  | .RI [ TARGET ...] | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 		Add file to the dotfiles directory. |  |  |  | 
 | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | .SH DESCRIPTION | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 	${b}-f, --files${n} |  |  |  | dotfiles.sh is a config file and package tracking utility that tracks installed packages on a Linux system. | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 		Display all files added to the dotfiles directory. |  |  |  | It features listing and tracking of config files and packages, and the ability to install the tracked packages. | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 	${b}-h, --help${n} |  |  |  | Currently, package tracking is only supported on APT and Pacman based distributions. | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 		Display usage message and exit. |  |  |  | 
 | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | Invoking dotfile.sh involves specifying an operation with any potential options and targets to operate on. | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 	${b}-p${n} [${u}FUNCTION${n}], ${b}--packages${n}=[${u}FUNCTION${n}] |  |  |  | A \fItarget\fR is usually a file name, directory or a package name. | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 		Apply ${u}FUNCTION${n} to the package manager packages. |  |  |  | Targets can be provided as command line arguments. | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | Additionally, if a single hyphen (-) is passed as an argument, targets will be read from stdin. | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 		${u}install${n}      Install all core packages of the stored list. |  |  |  | 
 | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | .SH OPERATIONS | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 		${u}install-aur${n}  Install all AUR packages of the stored list. |  |  |  | .TP | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | .BR \-F ", " \-\-file | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 		${u}list${n}         Display all packages installed on the system. |  |  |  | Operate on config files. | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | This operation allows you to sync config files between the system and the dotfiles directory. | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 		${u}store${n}        Stores a list of all installed packages on the system. |  |  |  | In the first case, if no file names are provided in the command line, all files will be selected. | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | See File Options below. | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 		The default value is ${u}list${n}. |  |  |  | 
 | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | .TP | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 	${b}-l, --pull${n} |  |  |  | .BR \-P ", " \-\-package | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 		Pull each added file from the system to the dotfiles directory. |  |  |  | Operate on packages. | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | This operation allows you to track installed packages and reinstall them. | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 	${b}-s, --push${n} |  |  |  | In the first case, if no package names are provided in the command line, all packages will be selected. | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 		Push each added file to its location on the system. |  |  |  | See Package Options below. | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | .TP | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | .BR \-h ", " \-\-help | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | Display usage message and exit. | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | .SH FILE OPTIONS (APPLY TO -F) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | .TP | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | .BR \-a ", " \-\-add | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | Add selected file \fIpaths\fR to the dotfiles directory. | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | .TP | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | .BR \-l ", " \-\-pull | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | Pull every (selected) \fIfile\fR from the system to the dotfiles directory. | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | .TP | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | .BR \-s ", " \-\-push | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | Push every (selected) \fIfile\fR from the dotfiles directory to the system. | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | .SH PACKAGE OPTIONS (APPLY TO -P) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | .TP | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | .BR \-a ", " \-\-aur-install | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | Install all AUR packages of the stored list. | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | .TP | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | .BR \-i ", " \-\-install | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | Install all official packages of the stored list. | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | .TP | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | .BR \-s ", " \-\-store | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | Stores a list of all installed packages on the system. | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | .SH EXAMPLES | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | Usage examples: | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | $ \fB./dotfiles.sh\fR -Fa ~/.zshrc /etc/zsh/zshenv | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | .br | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | \h'4'Add config files to the dotfiles directory | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | $ \fB./dotfiles.sh\fR -Pia | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | .br | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | \h'4'Install all tracked official and AUR packages | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | .SH AUTHOR | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | Riyyi | 
			
		
	
		
		
			
				
					
					|  |  |  | EOF |  |  |  | EOF | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	) | man -l - | 
			
		
	
		
		
			
				
					
					|  |  |  | } |  |  |  | } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | # Exit if no option is provided |  |  |  | # Exit if no option is provided | 
			
		
	
		
		
			
				
					
					|  |  |  | [ "$#" -eq 0 ] && help >&2 && exit 1 |  |  |  | [ "$#" -eq 0 ] && help && exit 1 | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | # Files |  |  |  | # Files | 
			
		
	
		
		
			
				
					
					|  |  |  | # -------------------------------------- |  |  |  | # -------------------------------------- | 
			
		
	
	
		
		
			
				
					|  |  | 
 |