@sebastienrousseau/dotfiles 0.2.466 β†’ 0.2.468

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (166) hide show
  1. package/README.md +19 -15
  2. package/dist/Makefile +2 -2
  3. package/dist/bin/backup.js.map +1 -1
  4. package/dist/bin/constants.d.ts +2 -2
  5. package/dist/bin/constants.js +1 -1
  6. package/dist/bin/dotfiles.d.ts +2 -2
  7. package/dist/bin/dotfiles.d.ts.map +1 -1
  8. package/dist/bin/dotfiles.js +1 -2
  9. package/dist/bin/dotfiles.js.map +1 -1
  10. package/dist/bin/download.d.ts +2 -2
  11. package/dist/bin/download.d.ts.map +1 -1
  12. package/dist/bin/download.js +1 -2
  13. package/dist/bin/download.js.map +1 -1
  14. package/dist/bin/index.js +1 -1
  15. package/dist/bin/index.js.map +1 -1
  16. package/dist/filesizes.txt +85 -87
  17. package/dist/lib/README.md +9 -5
  18. package/dist/lib/aliases/README.md +8 -4
  19. package/dist/lib/aliases/archives/README.md +29 -26
  20. package/dist/lib/aliases/archives/archives.aliases.sh +148 -145
  21. package/dist/lib/aliases/cd/README.md +46 -44
  22. package/dist/lib/aliases/cd/cd.aliases.sh +63 -29
  23. package/dist/lib/aliases/chmod/README.md +8 -4
  24. package/dist/lib/aliases/chmod/chmod.aliases.sh +60 -42
  25. package/dist/lib/aliases/clear/README.md +8 -4
  26. package/dist/lib/aliases/clear/clear.aliases.sh +57 -28
  27. package/dist/lib/aliases/configuration/README.md +8 -4
  28. package/dist/lib/aliases/configuration/configuration.aliases.sh +56 -30
  29. package/dist/lib/aliases/default/README.md +8 -4
  30. package/dist/lib/aliases/default/default.aliases.sh +99 -86
  31. package/dist/lib/aliases/dig/README.md +8 -4
  32. package/dist/lib/aliases/dig/dig.aliases.sh +3 -3
  33. package/dist/lib/aliases/disk-usage/README.md +8 -4
  34. package/dist/lib/aliases/disk-usage/du.aliases.sh +2 -2
  35. package/dist/lib/aliases/editor/README.md +8 -4
  36. package/dist/lib/aliases/editor/editor.aliases.sh +3 -3
  37. package/dist/lib/aliases/find/README.md +8 -4
  38. package/dist/lib/aliases/find/find.aliases.sh +3 -3
  39. package/dist/lib/aliases/gcloud/README.md +8 -4
  40. package/dist/lib/aliases/gcloud/gcloud.aliases.sh +3 -3
  41. package/dist/lib/aliases/git/README.md +8 -4
  42. package/dist/lib/aliases/git/git.aliases.sh +2 -2
  43. package/dist/lib/aliases/gnu/README.md +8 -4
  44. package/dist/lib/aliases/gnu/gnucoreutils-aliases.sh +1 -1
  45. package/dist/lib/aliases/heroku/README.md +8 -4
  46. package/dist/lib/aliases/heroku/heroku.aliases.sh +2 -2
  47. package/dist/lib/aliases/interactive/README.md +29 -17
  48. package/dist/lib/aliases/interactive/interactive.aliases.sh +14 -17
  49. package/dist/lib/aliases/jekyll/README.md +8 -4
  50. package/dist/lib/aliases/jekyll/jekyll.aliases.sh +3 -3
  51. package/dist/lib/aliases/list/README.md +8 -4
  52. package/dist/lib/aliases/list/list.aliases.sh +2 -2
  53. package/dist/lib/aliases/macOS/README.md +8 -4
  54. package/dist/lib/aliases/macOS/macos.aliases.sh +2 -2
  55. package/dist/lib/aliases/make/README.md +8 -4
  56. package/dist/lib/aliases/make/make.aliases.sh +2 -2
  57. package/dist/lib/aliases/mkdir/README.md +8 -4
  58. package/dist/lib/aliases/mkdir/mkdir.aliases.sh +2 -2
  59. package/dist/lib/aliases/npm/README.md +8 -4
  60. package/dist/lib/aliases/npm/npm.aliases.sh +2 -2
  61. package/dist/lib/aliases/permission/README.md +8 -4
  62. package/dist/lib/aliases/permission/permission.aliases.sh +2 -2
  63. package/dist/lib/aliases/pnpm/README.md +8 -4
  64. package/dist/lib/aliases/pnpm/pnpm.aliases.sh +2 -2
  65. package/dist/lib/aliases/ps/README.md +8 -4
  66. package/dist/lib/aliases/ps/ps.aliases.sh +2 -2
  67. package/dist/lib/aliases/rsync/README.md +8 -4
  68. package/dist/lib/aliases/rsync/rsync.aliases.sh +2 -2
  69. package/dist/lib/aliases/rust/README.md +8 -4
  70. package/dist/lib/aliases/rust/rust.aliases.sh +23 -23
  71. package/dist/lib/aliases/subversion/README.md +8 -4
  72. package/dist/lib/aliases/subversion/subversion.aliases.sh +2 -2
  73. package/dist/lib/aliases/sudo/README.md +8 -4
  74. package/dist/lib/aliases/sudo/sudo.aliases.sh +2 -2
  75. package/dist/lib/aliases/tmux/README.md +8 -4
  76. package/dist/lib/aliases/tmux/tmux.aliases.sh +2 -2
  77. package/dist/lib/aliases/update/README.md +8 -4
  78. package/dist/lib/aliases/update/update.aliases.sh +2 -2
  79. package/dist/lib/aliases/uuid/README.md +8 -4
  80. package/dist/lib/aliases/uuid/uuid.aliases.sh +2 -2
  81. package/dist/lib/aliases/wget/README.md +8 -4
  82. package/dist/lib/aliases/wget/wget.aliases.sh +2 -2
  83. package/dist/lib/aliases.sh +42 -12
  84. package/dist/lib/configurations/README.md +8 -4
  85. package/dist/lib/configurations/bash/bashrc +3 -3
  86. package/dist/lib/configurations/curl/curlrc +2 -2
  87. package/dist/lib/configurations/default/color.sh +2 -2
  88. package/dist/lib/configurations/default/constants.sh +3 -3
  89. package/dist/lib/configurations/default/editor.sh +2 -2
  90. package/dist/lib/configurations/default/prompt.sh +2 -2
  91. package/dist/lib/configurations/input/inputrc +2 -2
  92. package/dist/lib/configurations/nano/nanorc +2 -2
  93. package/dist/lib/configurations/profile/profile +2 -2
  94. package/dist/lib/configurations/tmux/default +2 -2
  95. package/dist/lib/configurations/tmux/display +2 -2
  96. package/dist/lib/configurations/tmux/linux +2 -2
  97. package/dist/lib/configurations/tmux/navigation +2 -2
  98. package/dist/lib/configurations/tmux/panes +2 -2
  99. package/dist/lib/configurations/tmux/theme +3 -3
  100. package/dist/lib/configurations/tmux/tmux +2 -2
  101. package/dist/lib/configurations/vim/vimrc +1 -1
  102. package/dist/lib/configurations/wget/wgetrc +2 -2
  103. package/dist/lib/configurations/zsh/zshrc +11 -11
  104. package/dist/lib/configurations.sh +27 -9
  105. package/dist/lib/functions/README.md +8 -4
  106. package/dist/lib/functions/cdls.sh +2 -2
  107. package/dist/lib/functions/curlheader.sh +2 -2
  108. package/dist/lib/functions/curlstatus.sh +2 -2
  109. package/dist/lib/functions/curltime.sh +3 -3
  110. package/dist/lib/functions/encode64.sh +2 -2
  111. package/dist/lib/functions/environment.sh +2 -2
  112. package/dist/lib/functions/extract.sh +2 -2
  113. package/dist/lib/functions/freespace.sh +2 -2
  114. package/dist/lib/functions/genpwd.sh +4 -4
  115. package/dist/lib/functions/goto.sh +2 -2
  116. package/dist/lib/functions/hidehiddenfiles.sh +2 -2
  117. package/dist/lib/functions/hostinfo.sh +2 -2
  118. package/dist/lib/functions/hstats.sh +2 -2
  119. package/dist/lib/functions/httpdebug.sh +2 -2
  120. package/dist/lib/functions/keygen.sh +2 -2
  121. package/dist/lib/functions/last.sh +2 -2
  122. package/dist/lib/functions/logout.sh +2 -2
  123. package/dist/lib/functions/lowercase.sh +2 -2
  124. package/dist/lib/functions/matrix.sh +2 -2
  125. package/dist/lib/functions/mount_read_only.sh +2 -2
  126. package/dist/lib/functions/myproc.sh +2 -2
  127. package/dist/lib/functions/prependpath.sh +2 -2
  128. package/dist/lib/functions/ql.sh +2 -2
  129. package/dist/lib/functions/rd.sh +2 -2
  130. package/dist/lib/functions/remove_disk.sh +2 -2
  131. package/dist/lib/functions/ren.sh +2 -2
  132. package/dist/lib/functions/showhiddenfiles.sh +2 -2
  133. package/dist/lib/functions/size.sh +2 -2
  134. package/dist/lib/functions/stopwatch.sh +2 -2
  135. package/dist/lib/functions/uppercase.sh +2 -2
  136. package/dist/lib/functions/view-source.sh +2 -2
  137. package/dist/lib/functions/vscode.sh +2 -2
  138. package/dist/lib/functions/whoisport.sh +2 -2
  139. package/dist/lib/functions/zipf.sh +2 -2
  140. package/dist/lib/functions.sh +27 -10
  141. package/dist/lib/history.sh +58 -21
  142. package/dist/lib/paths/ant/ant.paths.sh +2 -2
  143. package/dist/lib/paths/default/default.paths.sh +2 -2
  144. package/dist/lib/paths/homebrew/homebrew.paths.sh +2 -2
  145. package/dist/lib/paths/java/java.paths.sh +2 -2
  146. package/dist/lib/paths/maven/maven.paths.sh +2 -2
  147. package/dist/lib/paths/node/node.paths.sh +2 -2
  148. package/dist/lib/paths/nvm/nvm.paths.sh +2 -2
  149. package/dist/lib/paths/pnpm/pnpm.paths.sh +2 -2
  150. package/dist/lib/paths/python/python.paths.sh +2 -2
  151. package/dist/lib/paths/ruby/ruby.paths.sh +2 -2
  152. package/dist/lib/paths/tmux/tmux.paths.sh +2 -2
  153. package/dist/lib/paths.sh +28 -12
  154. package/dist/scripts/backup.sh +2 -2
  155. package/dist/scripts/banner.sh +2 -2
  156. package/dist/scripts/build.sh +2 -2
  157. package/dist/scripts/clean.sh +2 -2
  158. package/dist/scripts/compile.sh +2 -2
  159. package/dist/scripts/copy.sh +2 -2
  160. package/dist/scripts/dotfiles.sh +2 -2
  161. package/dist/scripts/download.sh +2 -2
  162. package/dist/scripts/help.sh +2 -2
  163. package/dist/scripts/ssh.sh +2 -2
  164. package/dist/scripts/unpack.sh +2 -2
  165. package/package.json +6 -5
  166. package/dist/lib/configurations/tmux/vi +0 -9
@@ -1,154 +1,157 @@
1
1
  #!/usr/bin/env bash
2
2
 
3
- # πŸ…³πŸ…ΎπŸ†ƒπŸ…΅πŸ…ΈπŸ…»πŸ…΄πŸ†‚ (v0.2.466) - <https://dotfiles.io>
4
- # Made with β™₯ in London, UK by @wwdseb
5
- # Copyright (c) 2015-2023. All rights reserved
6
- # License: MIT
3
+ ################################################################################
4
+ # πŸ…³πŸ…ΎπŸ†ƒπŸ…΅πŸ…ΈπŸ…»πŸ…΄πŸ†‚
7
5
  # Script: archives.aliases.sh
8
- # Version: 0.2.466
6
+ # Version: 0.2.468
7
+ # Author: @wwdseb
8
+ # Copyright (c) 2015-2024. All rights reserved
9
+ # Description:
10
+ # This script defines aliases for common archive operations. It provides
11
+ # shortcuts for compressing and extracting various types of archive files.
9
12
  # Website: https://dotfiles.io
13
+ # License: MIT
14
+ ################################################################################
10
15
 
11
16
  # πŸ…°πŸ†πŸ…²πŸ…·πŸ…ΈπŸ†…πŸ…΄πŸ†‚ πŸ…°πŸ…»πŸ…ΈπŸ…°πŸ†‚πŸ…΄πŸ†‚
12
- if command -v 7z &>/dev/null; then
13
- # Compress a whole directory (including subdirectories) to a 7z file.
14
- alias c7z='7z a'
15
- # Extract a whole directory (including subdirectories) from a 7z file.
16
- alias e7z='7z x'
17
- fi
18
-
19
- if command -v tar &>/dev/null; then
20
- # Compress a file to a bzip2 file.
21
- alias cbzip2='tar -cvjf'
22
- # Compress a whole directory (including subdirectories) to a tar file.
23
- alias ctar='tar -cvf'
24
- # Extract a whole directory (including subdirectories) from a tar
25
- # file.
26
- alias etar='tar -xvf'
27
- # Compress a file to a gzip file.
28
- alias cgzip='tar -zcvf'
29
- # Compress a whole directory (including subdirectories) to an xz file.
30
- alias cxz='tar -cvJf'
31
- # Extract a file from a bzip2 file.
32
- alias ebzip2='tar -xvjf'
33
- # Extract a file from a gzip file.
34
- alias egzip='tar -xvzf'
35
- # Extract a whole directory (including subdirectories) from an xz
36
- # file.
37
- alias exz='tar -xvJf'
38
- fi
39
-
40
- if command -v jar &>/dev/null; then
41
- # Compress a whole directory (including subdirectories) to a jar file.
42
- alias cjar='jar -cvf'
43
- # Extract a whole directory (including subdirectories) from a jar
44
- # file.
45
- alias ejar='jar -xvf'
46
- fi
47
-
48
- if command -v xz &>/dev/null; then
49
- # Compress a whole directory (including subdirectories) to an xz file.
50
- alias cxz2='xz -zcvf'
51
- # Extract a whole directory (including subdirectories) from an xz
52
- # file.
53
- alias exz2='xz -zxvf'
54
- fi
55
-
56
- if command -v zip &>/dev/null; then
57
- # Compress a whole directory (including subdirectories) to a zip file.
58
- alias czip='zip -r'
59
- # Extract a whole directory (including subdirectories) from a zip
60
- # file.
61
- alias ezip='unzip'
62
- fi
63
-
64
- if command -v zstd &>/dev/null; then
65
- # Compress a whole directory (including subdirectories) to a zstd file.
66
- alias czstd='zstd -zcvf'
67
- # Extract a whole directory (including subdirectories) from a zstd
68
- # file.
69
- alias ezstd='zstd -zxvf'
70
- fi
71
-
72
- # Compress a file to a lzma file.
73
- if command -v xz &>/dev/null; then
74
- alias clzma='xz -zcvf'
75
- alias elzma='xz -zxvf'
76
- fi
77
-
78
- # Compress a file to a z file.
79
- if command -v gzip &>/dev/null; then
80
- alias czlib='gzip -cv'
81
- alias ezlib='gzip -dv'
82
- fi
83
-
84
- # Compress a file to a bz2 file.
85
- if command -v bzip2 &>/dev/null; then
86
- alias cbz2='bzip2 -zkvf'
87
- alias ebz2='bzip2 -dkvf'
88
- fi
89
-
90
- # Compress a file to a lzo file.
91
- if command -v lzop &>/dev/null; then
92
- alias clzo='lzop -cv'
93
- alias elzo='lzop -dv'
94
- fi
95
-
96
- # Compress a file to a lz4 file.
97
- if command -v lz4 &>/dev/null; then
98
- alias clz4='lz4 -zcv'
99
- alias elz4='lz4 -dcv'
100
- fi
101
-
102
- # Compress a file to a zst file.
103
- if command -v zstd &>/dev/null; then
104
- alias czst='zstd -zcv'
105
- alias ezst='zstd -dcv'
106
- fi
107
-
108
- # Compress a file to a pigz file.
109
- if command -v pigz &>/dev/null; then
110
- alias cpgz='pigz -zkvf'
111
- alias epgz='pigz -dkvf'
112
- fi
113
17
 
114
- # Compress a whole directory (including subdirectories) to a tar.bz2
115
- # file.
116
- if command -v tar &>/dev/null && command -v bzip2 &>/dev/null; then
117
- alias ctbz2='tar -cvjf'
118
- alias etbz2='tar -xvjf'
18
+ ## Check for existence of archive programs
19
+ if type 7z &> /dev/null; then
20
+ alias compress_7z='7z a'
21
+ alias extract_7z='7z x'
119
22
  fi
120
23
 
121
- # Compress a whole directory (including subdirectories) to a tar.lzma
122
- # file.
123
- if command -v tar &>/dev/null && command -v xz &>/dev/null; then
124
- alias ctlzma='tar --lzma -cvf'
125
- alias etlzma='tar --lzma -xvf'
126
- fi
127
-
128
- # Compress a whole directory (including subdirectories) to a tar.gz
129
- # file.
130
- if command -v tar &>/dev/null && command -v gzip &>/dev/null; then
131
- alias ctgz='tar -zcvf'
132
- alias etgz='tar -zxvf'
133
- fi
134
-
135
- # Compress a whole directory (including subdirectories) to a tar.lzo
136
- # file.
137
- if command -v tar &>/dev/null && command -v lzop &>/dev/null; then
138
- alias ctlzo='tar --lzip -cvf'
139
- alias etlzo='tar --lzip -xvf'
140
- fi
141
-
142
- # Compress a whole directory (including subdirectories) to a tar.zst
143
- # file.
144
- if command -v tar &>/dev/null && command -v zstd &>/dev/null; then
145
- alias ctzst='tar --zstd -cvf'
146
- alias etzst='tar --zstd -xvf'
147
- fi
148
-
149
- # Compress a whole directory (including subdirectories) to a tar.pgz
150
- # file.
151
- if command -v tar &>/dev/null && command -v pigz &>/dev/null; then
152
- alias ctpgz='tar --use-compress-program=pigz -cvf'
153
- alias etpgz='tar --use-compress-program=pigz -xvf'
154
- fi
24
+ if type tar &> /dev/null; then
25
+ alias compress_tar='tar -cvf'
26
+ alias extract_tar='tar -xvf'
27
+ alias compress_tar_gzip='tar -zcvf'
28
+ alias extract_tar_gzip='tar -zxvf'
29
+ alias compress_tar_bzip2='tar -cvjf'
30
+ alias extract_tar_bzip2='tar -xvjf'
31
+ fi
32
+
33
+ if type jar &> /dev/null; then
34
+ alias compress_jar='jar -cvf'
35
+ alias extract_jar='jar -xvf'
36
+ fi
37
+
38
+ if type xz &> /dev/null; then
39
+ alias compress_xz='tar -cvJf'
40
+ alias extract_xz='tar -xvJf'
41
+ fi
42
+
43
+ if type zip &> /dev/null; then
44
+ alias compress_zip='zip -r'
45
+ alias extract_zip='unzip'
46
+ fi
47
+
48
+ if type zstd &> /dev/null; then
49
+ alias compress_zstd='zstd -zcvf'
50
+ alias extract_zstd='zstd -zxvf'
51
+ fi
52
+
53
+ if type gzip &> /dev/null; then
54
+ alias compress_gzip='gzip -cv'
55
+ alias extract_gzip='gzip -dv'
56
+ fi
57
+
58
+ if type bzip2 &> /dev/null; then
59
+ alias compress_bzip2='bzip2 -zkvf'
60
+ alias extract_bzip2='bzip2 -dkvf'
61
+ fi
62
+
63
+ if type lzop &> /dev/null; then
64
+ alias compress_lzop='lzop -cv'
65
+ alias extract_lzop='lzop -dv'
66
+ fi
67
+
68
+ if type lz4 &> /dev/null; then
69
+ alias compress_lz4='lz4 -zcv'
70
+ alias extract_lz4='lz4 -dcv'
71
+ fi
72
+
73
+ if type pigz &> /dev/null; then
74
+ alias compress_pigz='pigz -zkvf'
75
+ alias extract_pigz='pigz -dkvf'
76
+ fi
77
+
78
+ # πŸ…³πŸ…΄πŸ…΅πŸ…΄πŸ…½πŸ†‚πŸ…ΈπŸ†…πŸ…΄ πŸ…²πŸ…ΎπŸ…³πŸ…ΈπŸ…½πŸ…Ά
79
+
80
+ # Ensure valid arguments are passed
81
+ function compress_file() {
82
+ local archive_type="$1"
83
+ case "${archive_type}" in
84
+ 7z|tar|jar|xz|zip|zstd|gzip|bzip2|lzop|lz4|pigz)
85
+ alias "compress_${archive_type}" "${archive_type} -cvf"
86
+ ;;
87
+ *)
88
+ echo "Unsupported archive type: ${archive_type}"
89
+ return 1
90
+ ;;
91
+ esac
92
+ }
93
+
94
+ function extract_file() {
95
+ local archive_type="$1"
96
+ case "${archive_type}" in
97
+ 7z|tar|jar|xz|zip|zstd|gzip|bzip2|lzop|lz4|pigz)
98
+ alias "extract_${archive_type}" "${archive_type} -xvf"
99
+ ;;
100
+ *)
101
+ echo "Unsupported archive type: ${archive_type}"
102
+ return 1
103
+ ;;
104
+ esac
105
+ }
106
+
107
+ # Handle large files by piping outputs
108
+ function compress_large_file() {
109
+ local archive_type="$1"
110
+ case "${archive_type}" in
111
+ 7z|tar|jar|xz|zip|zstd|gzip|bzip2|lzop|lz4|pigz)
112
+ alias "compress_${archive_type}" "${archive_type} -cvf -"
113
+ ;;
114
+ *)
115
+ echo "Unsupported archive type: ${archive_type}"
116
+ return 1
117
+ ;;
118
+ esac
119
+ }
120
+
121
+ function extract_large_file() {
122
+ local archive_type="$1"
123
+ case "${archive_type}" in
124
+ 7z|tar|jar|xz|zip|zstd|gzip|bzip2|lzop|lz4|pigz)
125
+ alias "extract_${archive_type}" "${archive_type} -xvf -"
126
+ ;;
127
+ *)
128
+ echo "Unsupported archive type: ${archive_type}"
129
+ return 1
130
+ ;;
131
+ esac
132
+ }
133
+
134
+ # πŸ…ΏπŸ…ΎπŸ†πŸ†ƒπŸ…°πŸ…±πŸ…ΈπŸ…»πŸ…ΈπŸ†ƒπŸ†ˆ
135
+
136
+ function set_alias() {
137
+ local program="$1"
138
+ local flags="$2"
139
+ # shellcheck disable=SC2250,SC2139
140
+ alias "compress_$program"="${program} ${flags}"
141
+
142
+ }
143
+
144
+ # Set better defaults in case archive programs are missing
145
+ set_alias compress_bz2 bzip2 '-zkvf'
146
+ set_alias compress_lz4 lz4 '-zcv'
147
+ set_alias compress_lzma xz '-zcvf'
148
+ set_alias compress_lzo lzop '-cv'
149
+ set_alias compress_pgz pigz '-zkvf'
150
+ set_alias compress_tbz2 tar '-cvjf'
151
+ set_alias compress_tgz tar '--use-compress-program=pigz -cvf'
152
+ set_alias compress_tgz tar '-zcvf'
153
+ set_alias compress_tlzo tar '--lzip -cvf'
154
+ set_alias compress_txz tar '-cvJf'
155
+ set_alias compress_tzst tar '--zstd -cvf'
156
+ set_alias compress_zlib gzip '-cv'
157
+ set_alias compress_zstd zstd '-zcvf'
@@ -1,63 +1,65 @@
1
- <!-- markdownlint-disable MD033 MD041 -->
1
+ <!-- markdownlint-disable MD033 MD041 MD043 -->
2
2
 
3
- <img src="https://kura.pro/dotfiles/v2/images/logos/dotfiles.svg"
4
- alt="dotfiles logo" width="261" align="right" />
3
+ <img
4
+ src="https://kura.pro/dotfiles/v2/images/logos/dotfiles.svg"
5
+ alt="dotfiles logo"
6
+ width="261"
7
+ align="right"
8
+ />
5
9
 
6
10
  <!-- markdownlint-enable MD033 MD041 -->
7
11
 
8
- # Dotfiles (v0.2.466)
12
+ # Dotfiles (v0.2.468)
9
13
 
10
- Simply designed to fit your shell life 🐚
14
+ Designed to seamlessly enhance your shell environment 🐚
11
15
 
12
16
  ![Dotfiles banner][banner]
13
17
 
14
18
  ## πŸ…²πŸ…³ πŸ…°πŸ…»πŸ…ΈπŸ…°πŸ†‚πŸ…΄πŸ†‚
15
19
 
16
- These aliases provide shortcuts for the cd command to help you quickly
17
- navigate your file system. To use them, add the following lines to your
18
- .bashrc or .bash_profile file.
20
+ This set of `cd` command aliases provides an intuitive and efficient way to
21
+ navigate your filesystem. Incorporating dynamic error handling, optional
22
+ directory listing, and customization for an improved command-line experience.
19
23
 
20
- ### Navigation
24
+ ### Setup
21
25
 
22
- - `-`: Go to previous directory.
23
- - `.., ..., ...., .....`: Go up one, two, three, or four directories,
24
- respectively.
25
- - `~`: Go to home directory.
26
+ To use these aliases, integrate the script into your `.bashrc` or `.bash_profile`.
26
27
 
27
- ### Directories
28
+ ### Navigation Shortcuts
28
29
 
29
- - `app`: Go to the Applications directory and list its contents.
30
- - `cod`: Go to the Code directory and list its contents.
31
- - `des`: Go to the Desktop directory and list its contents.
32
- - `doc`: Go to the Documents directory and list its contents.
33
- - `dot`: Go to the .dotfiles directory and list its contents.
34
- - `dow`: Go to the Downloads directory and list its contents.
35
- - `hom`: Go to the home directory and list its contents.
36
- - `mus`: Go to the Music directory and list its contents.
37
- - `pic`: Go to the Pictures directory and list its contents.
38
- - `vid`: Go to the Videos directory and list its contents.
30
+ * `-`: Go to the previous directory.
31
+ * `..`, `...`, `....`, `.....`: Ascend one to four levels in the directory tree.
32
+ * `~`: Navigate to the home directory.
33
+
34
+ ### Custom Directory Access
35
+
36
+ Leverage aliases for quick access to frequently visited directories:
37
+
38
+ * `app`: Applications directory
39
+ * `cod`: Code directory
40
+ * `des`: Desktop directory
41
+ * `doc`: Documents directory
42
+ * `dot`: Dotfiles directory
43
+ * `dow`: Downloads directory
44
+ * `mus`: Music directory
45
+ * `pic`: Pictures directory
46
+ * `vid`: Videos directory
39
47
 
40
48
  ### System Directories
41
49
 
42
- - `etc`: Go to the etc directory and list its contents.
43
- - `var`: Go to the var directory and list its contents.
44
- - `tmp`: Go to the tmp directory and list its contents.
45
-
46
- ### Frequently used directories
47
-
48
- - `app`: Shortcut to go to the Applications directory and list its
49
- contents.
50
- - `cod`: Shortcut to go to the Code directory and list its contents.
51
- - `des`: Shortcut to go to the Desktop directory and list its contents.
52
- - `doc`: Shortcut to go to the Documents directory and list its
53
- contents.
54
- - `dot`: Shortcut to go to the .dotfiles directory and list its
55
- contents.
56
- - `dow`: Shortcut to go to the Downloads directory and list its
57
- contents.
58
- - `hom`: Shortcut to go to the home directory and list its contents.
59
- - `mus`: Shortcut to go to the Music directory and list its contents.
60
- - `pic`: Shortcut to go to the Pictures directory and list its contents.
61
- - `vid`: Shortcut to go to the Videos directory and list its contents.
50
+ Quickly access system directories:
51
+
52
+ * `etc`: System configuration (`/etc`)
53
+ * `var`: Variable files (`/var`)
54
+ * `tmp`: Temporary files (`/tmp`)
55
+
56
+ ### Enhanced Customization
57
+
58
+ Customize directory paths through environment variables to suit your system's
59
+ structure and preferences. Use concise aliases (`app`, `cod`, `des`, etc.) for
60
+ efficient navigation.
61
+
62
+ For a detailed guide on configuring and using these aliases, plus additional
63
+ information on each command, visit our [documentation](https://dotfiles.io).
62
64
 
63
65
  [banner]: https://kura.pro/dotfiles/v2/images/titles/title-dotfiles.svg
@@ -1,39 +1,73 @@
1
1
  #!/usr/bin/env bash
2
+
3
+ ################################################################################
4
+ # πŸ…³πŸ…ΎπŸ†ƒπŸ…΅πŸ…ΈπŸ…»πŸ…΄πŸ†‚
2
5
  # Author: Sebastien Rousseau
3
- # Copyright (c) 2015-2023. All rights reserved
4
- # Description: Sets aliases for the `cd` command.
6
+ # Copyright: 2015-2024. All rights reserved
7
+ # Description: Enhanced `cd` command aliases with checks, functions, and customization.
5
8
  # License: MIT
6
9
  # Script: cd.aliases.sh
7
- # Version: 0.2.466
10
+ # Version: 0.2.468
8
11
  # Website: https://dotfiles.io
9
12
 
10
- # πŸ…²πŸ…³ πŸ…°πŸ…»πŸ…ΈπŸ…°πŸ†‚πŸ…΄πŸ†‚
13
+ # Usage:
14
+ # Customize directory paths via variables and use aliases to navigate.
15
+ # Example: `cod` to go to the Code directory, `..` to go up one directory.
11
16
 
12
- # Shortcut to go to previous directory
13
- alias -- -='cd -'
17
+ # Configuration
18
+ DOC_DIR="${HOME}/Documents"
19
+ VID_DIR="${HOME}/Videos"
20
+ # Add more configurable paths here
21
+
22
+ # Check if directory exists and change to it, listing contents optionally
23
+ change_directory() {
24
+ local path="$1"
14
25
 
15
- # Shortcuts to go to parent directories
16
- alias .....='cd ../../../../'
17
- alias ....='cd ../../'
18
- alias ...='cd ../'
26
+ if [[ -d "${path}" ]]; then
27
+ cd "${path}" || exit # Exit if cd fails
28
+ else
29
+ echo "Directory '${path}' does not exist."
30
+ fi
31
+ }
32
+
33
+ # Parent Directory Shortcuts
34
+ alias -- -='cd -'
19
35
  alias ..='cd ..'
36
+ alias ...='cd ../..'
37
+ alias ....='cd ../../..'
38
+ alias .....='cd ../../../..'
39
+
40
+ # Home Directory Shortcut
41
+ alias hom='change_directory "${HOME}" true'
42
+
43
+ # Frequently Used Directories
44
+ alias doc='change_directory "$DOC_DIR" true' # Documents
45
+ alias vid='change_directory "$VID_DIR" true' # Videos
46
+ # Define more aliases like the above for other directories
47
+
48
+ # System Directories (consider checks for system-specific paths)
49
+ alias etc='change_directory "/etc" true'
50
+ alias var='change_directory "/var" true'
51
+ alias tmp='change_directory "/tmp" true'
52
+
53
+ # Frequently Used Directories with Improved Error Handling and Customization
54
+ APP_DIR="${HOME}/Applications"
55
+ CODE_DIR="${HOME}/Code"
56
+ DESK_DIR="${HOME}/Desktop"
57
+ DOCS_DIR="${HOME}/Documents"
58
+ DOTF_DIR="${HOME}/.dotfiles"
59
+ DOWN_DIR="${HOME}/Downloads"
60
+ MUSIC_DIR="${HOME}/Music"
61
+ PICS_DIR="${HOME}/Pictures"
62
+ VIDS_DIR="${HOME}/Videos"
20
63
 
21
- # Shortcuts to go to specific directories
22
- alias '~'='cd ~'
23
-
24
- # Shortcuts to go to frequently used directories
25
- alias app='cd "${HOME}/Applications"; ls' # app: Shortcut to go to the Applications directory and list its contents.
26
- alias cod='cd "${HOME}/Code"; ls' # cod: Shortcut to go to the Code directory and list its contents.
27
- alias des='cd "${HOME}/Desktop"; ls' # des: Shortcut to go to the Desktop directory and list its contents.
28
- alias doc='cd "${HOME}/Documents"; ls' # doc: Shortcut to go to the Documents directory and list its contents.
29
- alias dot='cd "${HOME}/.dotfiles"; ls' # dot: Shortcut to go to the .dotfiles directory and list its contents.
30
- alias dow='cd "${HOME}/Downloads"; ls' # dow: Shortcut to go to the Downloads directory and list its contents.
31
- alias hom='cd "${HOME}"; ls' # hom: Shortcut to go to the home directory and list its contents.
32
- alias mus='cd "${HOME}/Music"; ls' # mus: Shortcut to go to the Music directory and list its contents.
33
- alias pic='cd "${HOME}/Pictures"; ls' # pic: Shortcut to go to the Pictures directory and list its contents.
34
- alias vid='cd "${HOME}/Videos"; ls' # vid: Shortcut to go to the Videos directory and list its contents.
35
-
36
- # Shortcuts to navigate to system directories
37
- alias etc='cd /etc; ls' # etc: Shortcut to go to the etc directory and list its contents.
38
- alias var='cd /var; ls' # var: Shortcut to go to the var directory and list its contents.
39
- alias tmp='cd /tmp; ls' # tmp: Shortcut to go to the tmp directory and list its contents.
64
+ # Define functions for each alias with checks and optional ls
65
+ alias app='change_directory "$APP_DIR" true' # Applications
66
+ alias cod='change_directory "$CODE_DIR" true' # Code
67
+ alias des='change_directory "$DESK_DIR" true' # Desktop
68
+ alias doc='change_directory "$DOCS_DIR" true' # Documents
69
+ alias dot='change_directory "$DOTF_DIR" true' # Dotfiles
70
+ alias dow='change_directory "$DOWN_DIR" true' # Downloads
71
+ alias mus='change_directory "$MUSIC_DIR" true' # Music
72
+ alias pic='change_directory "$PICS_DIR" true' # Pictures
73
+ alias vid='change_directory "$VIDS_DIR" true' # Videos
@@ -1,11 +1,15 @@
1
- <!-- markdownlint-disable MD033 MD041 -->
1
+ <!-- markdownlint-disable MD033 MD041 MD043 -->
2
2
 
3
- <img src="https://kura.pro/dotfiles/v2/images/logos/dotfiles.svg"
4
- alt="dotfiles logo" width="261" align="right" />
3
+ <img
4
+ src="https://kura.pro/dotfiles/v2/images/logos/dotfiles.svg"
5
+ alt="dotfiles logo"
6
+ width="261"
7
+ align="right"
8
+ />
5
9
 
6
10
  <!-- markdownlint-enable MD033 MD041 -->
7
11
 
8
- # Dotfiles (v0.2.466)
12
+ # Dotfiles (v0.2.468)
9
13
 
10
14
  Simply designed to fit your shell life 🐚
11
15
 
@@ -1,41 +1,70 @@
1
1
  #!/usr/bin/env bash
2
- # Author: Sebastien Rousseau
3
- # Copyright (c) 2015-2023. All rights reserved
4
- # Description: Sets aliases for the `chmod` command.
5
- # License: MIT
2
+
3
+ ################################################################################
4
+ # πŸ…³πŸ…ΎπŸ†ƒπŸ…΅πŸ…ΈπŸ…»πŸ…΄πŸ†‚
6
5
  # Script: chmod.aliases.sh
7
- # Version: 0.2.466
6
+ # Version: 0.2.468
7
+ # Author: @wwdseb
8
+ # Copyright (c) 2015-2024. All rights reserved
9
+ # Description: Enhanced chmod command aliases with safety features, input validation, and structured organization.
8
10
  # Website: https://dotfiles.io
11
+ # License: MIT
12
+ ################################################################################
13
+
14
+ # Ensuring chmod command is available
15
+ if command -v chmod >/dev/null; then
9
16
 
10
- # πŸ…²πŸ…·πŸ…ΌπŸ…ΎπŸ…³ πŸ…°πŸ…»πŸ…ΈπŸ…°πŸ†‚πŸ…΄πŸ†‚
11
- if command -v 'chmod' >/dev/null; then
17
+ # Validate input for permission and path
18
+ function validate_input() {
19
+ local permission="$1"
20
+ local path="$2"
21
+ # Validate permission pattern (e.g., numeric octal)
22
+ if ! [[ ${permission} =~ ^[0-7]{3}$ ]]; then
23
+ echo "Invalid permission format: ${permission}. Expected format: ### (e.g., 644)."
24
+ return 1
25
+ fi
26
+ # Validate path existence
27
+ if ! [[ -e "${path}" ]]; then
28
+ echo "Path does not exist: ${path}."
29
+ return 1
30
+ fi
31
+ return 0
32
+ }
12
33
 
13
- # Shortcuts to change permissions
14
- alias 000='chmod -R 000' # 000: (chmod a-rwx) sets permissions so that, (U)ser / owner can't read, can't write and can't execute. (G)roup can't read, can't write and can't execute. (O)thers can't read, can't write and can't execute.
15
- alias 400='chmod -R 400' # 400: (chmod a-rw) sets permissions so that, (U)ser / owner can't read, can't write and can execute. (G)roup can't read, can't write and can execute. (O)thers can't read, can't write and can execute.
16
- alias 444='chmod -R 444' # 444: (chmod a-r) sets permissions so that, (U)ser / owner can't read, can't write and can execute. (G)roup can't read, can't write and can execute. (O)thers can't read, can't write and can execute.
17
- alias 600='chmod -R 600' # 600: (chmod a+rwx,u-x,g-rwx,o-rwx) sets permissions so that, (U)ser / owner can read, can write and can't execute. (G)roup can't read, can't write and can't execute. (O)thers can't read, can't write and can't execute.
18
- alias 644='chmod -R 644' # 644: (chmod a+rwx,u-x,g-wx,o-wx) sets permissions so that, (U)ser / owner can read, can write and can't execute. (G)roup can read, can't write and can't execute. (O)thers can read, can't write and can't execute.
19
- alias 666='chmod -R 666' # 666: (chmod a+rwx,u-x,g-x,o-x) sets permissions so that, (U)ser / owner can read, can write and can't execute. (G)roup can read, can write and can't execute. (O)thers can read, can write and can't execute.
20
- alias 755='chmod -R 755' # 755: (chmod a+rwx,g-w,o-w) sets permissions so that, (U)ser / owner can read, can write and can execute. (G)roup can read, can't write and can execute. (O)thers can read, can't write and can execute.
21
- alias 764='chmod -R 764' # 764: (chmod a+rwx,g-x,o-wx) sets permissions so that, (U)ser / owner can read, can write and can execute. (G)roup can read, can write and can't execute. (O)thers can read, can't write and can't execute.
22
- alias 777='chmod -R 777' # 777: (chmod a+rwx) sets permissions so that, (U)ser / owner can read, can write and can execute. (G)roup can read, can write and can execute. (O)thers can read, can write and can execute.
34
+ # Function to change permissions with confirmation for recursive changes
35
+ function change_permission() {
36
+ local permission="$1"
37
+ local path="$2"
38
+ local recursive="$3"
39
+ local confirm
23
40
 
24
- # Shortcuts to change ownership
25
- alias chgrp='chgrp -v' # chgrp: Change group ownership of files or directories.
26
- alias chgrpr='chgrp -Rv' # chgrpr: Change group ownership of files or directories recursively.
27
- alias chgrpu='chgrp -Rv ${USER}' # chgrpu: Change group ownership of files or directories recursively to the current user.
28
- alias chmod='chmod -v' # chmod: Change file mode bits.
29
- alias chmodr='chmod -Rv' # chmodr: Change file mode bits recursively.
30
- alias chmodu='chmod -Rv u+rwX' # chmodu: Change file mode bits recursively to the current user.
31
- alias chmox='chmod +x' # chmox: Make a file executable.
32
- alias chown='chown -v' # chown: Change file owner and group.
33
- alias chownr='chown -Rv' # chownr: Change file owner and group recursively.
34
- alias chownu='chown -Rv ${USER}' # chownu: Change file owner and group recursively to the current user.
41
+ # Validate inputs
42
+ if ! validate_input "${permission}" "${path}"; then
43
+ return 1
44
+ fi
35
45
 
36
- # Shortcuts to set permissions for specific file types
37
- alias 755d='find . -type d -exec chmod 755 {} \;' # 755d: Set permissions of all directories to rwxr-xr-x.
38
- alias 644f='find . -type f -exec chmod 644 {} \;' # 644f: Set permissions of all files to rw-r--r--.
46
+ # Confirmation for recursive changes
47
+ if [[ "${recursive}" == "-R" ]]; then
48
+ read -rp "Confirm recursive change to ${permission} for ${path}? (y/N): " confirm
49
+ if [[ ${confirm} != [yY] ]]; then
50
+ echo "Operation cancelled."
51
+ return
52
+ fi
53
+ fi
54
+
55
+ chmod "${recursive}" "${permission}" "${path}" && echo "Permissions set to ${permission} on ${path}"
56
+ }
57
+
58
+ # Alias definitions using the function for common permissions
59
+ alias perm000='change_permission 000'
60
+ alias perm400='change_permission 400'
61
+ alias perm444='change_permission 444'
62
+ alias perm600='change_permission 600'
63
+ alias perm644='change_permission 644'
64
+ alias perm666='change_permission 666'
65
+ alias perm755='change_permission 755'
66
+ alias perm764='change_permission 764'
67
+ alias perm777='change_permission 777'
39
68
 
40
69
  # Shortcuts to set permissions for specific user types
41
70
  alias u+x='chmod u+x' # u+x: Add execute permission for the owner of the file.
@@ -59,15 +88,4 @@ if command -v 'chmod' >/dev/null; then
59
88
  alias o+r='chmod o+r' # o+r: Add read permission for others.
60
89
  alias o-r='chmod o-r' # o-r: Remove read permission for others.
61
90
 
62
- # Shortcuts to set permissions based on octal notation
63
- alias 000='chmod 000' # 000: Set permissions to ----------
64
- alias 400='chmod 400' # 400: Set permissions to r--------
65
- alias 444='chmod 444' # 444: Set permissions to r--r--r--
66
- alias 600='chmod 600' # 600: Set permissions to rw-------
67
- alias 644='chmod 644' # 644: Set permissions to rw-r--r--.
68
- alias 664='chmod 664' # 664: Set permissions to rw-rw-r--.
69
- alias 755='chmod 755' # 755: Set permissions to rwxr-xr-x.
70
- alias 775='chmod 775' # 775: Set permissions to rwxrwxr-x.
71
- alias 777='chmod 777' # 777: Set permissions to rwxrwxrwx.
72
-
73
91
  fi