@sebastienrousseau/dotfiles 0.2.469 → 0.2.499
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.
- package/docs/ARCHITECTURE.md +62 -0
- package/docs/COMPLIANCE.md +47 -0
- package/docs/COPYRIGHT +6 -0
- package/docs/OPERATIONS.md +103 -0
- package/docs/PLAN.md +161 -0
- package/docs/PR_DESCRIPTION.md +150 -0
- package/docs/ROADMAP.md +148 -0
- package/docs/ROADMAP_legacy.md +556 -0
- package/docs/SECURITY_CHECKLIST.md +25 -0
- package/docs/TASK.md +99 -0
- package/docs/WALKTHROUGH.md +46 -0
- package/package.json +64 -76
- package/scripts/backup.sh +142 -0
- package/{dist/scripts → scripts}/banner.sh +1 -1
- package/scripts/benchmark.sh +20 -0
- package/{dist/scripts → scripts}/build.sh +1 -1
- package/{dist/scripts → scripts}/clean.sh +1 -1
- package/{dist/scripts → scripts}/compile.sh +1 -1
- package/{dist/scripts → scripts}/copy.sh +1 -1
- package/scripts/detect-collisions.py +84 -0
- package/scripts/doctor.sh +79 -0
- package/{dist/scripts → scripts}/dotfiles.sh +1 -1
- package/{dist/scripts → scripts}/download.sh +1 -1
- package/{dist/scripts → scripts}/help.sh +1 -1
- package/scripts/lock-configs.sh +57 -0
- package/scripts/package.sh +46 -0
- package/{dist/scripts → scripts}/ssh.sh +1 -1
- package/scripts/teleport.sh +23 -0
- package/scripts/test-aliases.sh +25 -0
- package/scripts/test_smoke.sh +88 -0
- package/{dist/scripts → scripts}/unpack.sh +1 -1
- package/scripts/verify_state.sh +60 -0
- package/templates/projects/go/README.md +3 -0
- package/templates/projects/go/cmd/__PROJECT_NAME__/main.go +7 -0
- package/templates/projects/go/go.mod +3 -0
- package/templates/projects/node/README.md +3 -0
- package/templates/projects/node/package.json +10 -0
- package/templates/projects/node/src/index.js +2 -0
- package/templates/projects/python/README.md +3 -0
- package/templates/projects/python/pyproject.toml +10 -0
- package/templates/projects/python/src/__PROJECT_NAME__/__init__.py +1 -0
- package/templates/projects/python/tests/test_basic.py +2 -0
- package/LICENSE +0 -1283
- package/README.md +0 -398
- package/dist/Makefile +0 -140
- package/dist/bin/backup.d.ts +0 -3
- package/dist/bin/backup.d.ts.map +0 -1
- package/dist/bin/backup.js +0 -4
- package/dist/bin/backup.js.map +0 -1
- package/dist/bin/constants.d.ts +0 -7
- package/dist/bin/constants.d.ts.map +0 -1
- package/dist/bin/constants.js +0 -2
- package/dist/bin/constants.js.map +0 -1
- package/dist/bin/copy.d.ts +0 -3
- package/dist/bin/copy.d.ts.map +0 -1
- package/dist/bin/copy.js +0 -3
- package/dist/bin/copy.js.map +0 -1
- package/dist/bin/dotfiles.d.ts +0 -3
- package/dist/bin/dotfiles.d.ts.map +0 -1
- package/dist/bin/dotfiles.js +0 -2
- package/dist/bin/dotfiles.js.map +0 -1
- package/dist/bin/download.d.ts +0 -3
- package/dist/bin/download.d.ts.map +0 -1
- package/dist/bin/download.js +0 -2
- package/dist/bin/download.js.map +0 -1
- package/dist/bin/index.d.ts +0 -2
- package/dist/bin/index.d.ts.map +0 -1
- package/dist/bin/index.js +0 -1
- package/dist/bin/index.js.map +0 -1
- package/dist/bin/transfer.d.ts +0 -3
- package/dist/bin/transfer.d.ts.map +0 -1
- package/dist/bin/transfer.js +0 -4
- package/dist/bin/transfer.js.map +0 -1
- package/dist/bin/unpack.d.ts +0 -3
- package/dist/bin/unpack.d.ts.map +0 -1
- package/dist/bin/unpack.js +0 -3
- package/dist/bin/unpack.js.map +0 -1
- package/dist/filesizes.txt +0 -382
- package/dist/lib/README.md +0 -86
- package/dist/lib/aliases/README.md +0 -57
- package/dist/lib/aliases/archives/README.md +0 -145
- package/dist/lib/aliases/archives/archives.aliases.sh +0 -114
- package/dist/lib/aliases/cd/README.md +0 -146
- package/dist/lib/aliases/cd/cd.aliases.sh +0 -51
- package/dist/lib/aliases/chmod/README.md +0 -160
- package/dist/lib/aliases/chmod/chmod.aliases.sh +0 -107
- package/dist/lib/aliases/clear/README.md +0 -37
- package/dist/lib/aliases/clear/clear.aliases.sh +0 -71
- package/dist/lib/aliases/configuration/README.md +0 -39
- package/dist/lib/aliases/configuration/configuration.aliases.sh +0 -70
- package/dist/lib/aliases/default/README.md +0 -40
- package/dist/lib/aliases/default/default.aliases.sh +0 -139
- package/dist/lib/aliases/dig/README.md +0 -37
- package/dist/lib/aliases/dig/dig.aliases.sh +0 -43
- package/dist/lib/aliases/disk-usage/README.md +0 -36
- package/dist/lib/aliases/disk-usage/du.aliases.sh +0 -84
- package/dist/lib/aliases/editor/README.md +0 -53
- package/dist/lib/aliases/editor/editor.aliases.sh +0 -26
- package/dist/lib/aliases/find/README.md +0 -46
- package/dist/lib/aliases/find/find.aliases.sh +0 -60
- package/dist/lib/aliases/gcloud/README.md +0 -63
- package/dist/lib/aliases/gcloud/gcloud.aliases.sh +0 -335
- package/dist/lib/aliases/git/README.md +0 -153
- package/dist/lib/aliases/git/git.aliases.sh +0 -544
- package/dist/lib/aliases/gnu/README.md +0 -89
- package/dist/lib/aliases/gnu/gnucoreutils-aliases.sh +0 -150
- package/dist/lib/aliases/heroku/README.md +0 -430
- package/dist/lib/aliases/heroku/heroku.aliases.sh +0 -1053
- package/dist/lib/aliases/interactive/README.md +0 -55
- package/dist/lib/aliases/interactive/interactive.aliases.sh +0 -50
- package/dist/lib/aliases/list/README.md +0 -131
- package/dist/lib/aliases/list/list.aliases.sh +0 -132
- package/dist/lib/aliases/macOS/README.md +0 -42
- package/dist/lib/aliases/macOS/macos.aliases.sh +0 -65
- package/dist/lib/aliases/make/README.md +0 -32
- package/dist/lib/aliases/make/make.aliases.sh +0 -35
- package/dist/lib/aliases/mkdir/README.md +0 -30
- package/dist/lib/aliases/mkdir/mkdir.aliases.sh +0 -29
- package/dist/lib/aliases/npm/README.md +0 -41
- package/dist/lib/aliases/npm/npm.aliases.sh +0 -61
- package/dist/lib/aliases/permission/README.md +0 -47
- package/dist/lib/aliases/permission/permission.aliases.sh +0 -73
- package/dist/lib/aliases/pnpm/README.md +0 -53
- package/dist/lib/aliases/pnpm/pnpm.aliases.sh +0 -76
- package/dist/lib/aliases/ps/README.md +0 -29
- package/dist/lib/aliases/ps/ps.aliases.sh +0 -20
- package/dist/lib/aliases/python/python.aliases.sh +0 -141
- package/dist/lib/aliases/rsync/README.md +0 -25
- package/dist/lib/aliases/rsync/rsync.aliases.sh +0 -17
- package/dist/lib/aliases/rust/README.md +0 -182
- package/dist/lib/aliases/rust/rust.aliases.sh +0 -119
- package/dist/lib/aliases/subversion/README.md +0 -66
- package/dist/lib/aliases/subversion/subversion.aliases.sh +0 -47
- package/dist/lib/aliases/sudo/README.md +0 -27
- package/dist/lib/aliases/sudo/sudo.aliases.sh +0 -20
- package/dist/lib/aliases/tmux/README.md +0 -31
- package/dist/lib/aliases/tmux/tmux.aliases.sh +0 -36
- package/dist/lib/aliases/update/README.md +0 -38
- package/dist/lib/aliases/update/update.aliases.sh +0 -310
- package/dist/lib/aliases/uuid/README.md +0 -24
- package/dist/lib/aliases/uuid/uuid.aliases.sh +0 -19
- package/dist/lib/aliases/wget/README.md +0 -27
- package/dist/lib/aliases/wget/wget.aliases.sh +0 -22
- package/dist/lib/aliases.sh +0 -50
- package/dist/lib/configurations/README.md +0 -18
- package/dist/lib/configurations/bash/bashrc +0 -167
- package/dist/lib/configurations/curl/cacert.pem +0 -3460
- package/dist/lib/configurations/curl/curlrc +0 -53
- package/dist/lib/configurations/default/color.sh +0 -24
- package/dist/lib/configurations/default/constants.sh +0 -43
- package/dist/lib/configurations/default/editor.sh +0 -18
- package/dist/lib/configurations/default/prompt.sh +0 -48
- package/dist/lib/configurations/gem/gemrc +0 -9
- package/dist/lib/configurations/input/inputrc +0 -23
- package/dist/lib/configurations/jshint/jshintrc +0 -37
- package/dist/lib/configurations/nano/nanorc +0 -35
- package/dist/lib/configurations/profile/profile +0 -37
- package/dist/lib/configurations/prompt/prompt.sh +0 -81
- package/dist/lib/configurations/tmux/default +0 -18
- package/dist/lib/configurations/tmux/display +0 -30
- package/dist/lib/configurations/tmux/linux +0 -18
- package/dist/lib/configurations/tmux/navigation +0 -30
- package/dist/lib/configurations/tmux/panes +0 -10
- package/dist/lib/configurations/tmux/theme +0 -29
- package/dist/lib/configurations/tmux/tmux +0 -21
- package/dist/lib/configurations/vim/vimrc +0 -193
- package/dist/lib/configurations/wget/wgetrc +0 -40
- package/dist/lib/configurations/zsh/zshrc +0 -50
- package/dist/lib/configurations.sh +0 -45
- package/dist/lib/functions/README.md +0 -92
- package/dist/lib/functions/apihealth.sh +0 -277
- package/dist/lib/functions/apilatency.sh +0 -157
- package/dist/lib/functions/apiload.sh +0 -165
- package/dist/lib/functions/backup.sh +0 -143
- package/dist/lib/functions/cdls.sh +0 -60
- package/dist/lib/functions/curlheader.sh +0 -78
- package/dist/lib/functions/curlstatus.sh +0 -74
- package/dist/lib/functions/curltime.sh +0 -75
- package/dist/lib/functions/encode64.sh +0 -107
- package/dist/lib/functions/environment.sh +0 -78
- package/dist/lib/functions/extract.sh +0 -86
- package/dist/lib/functions/freespace.sh +0 -67
- package/dist/lib/functions/genpwd.sh +0 -105
- package/dist/lib/functions/goto.sh +0 -67
- package/dist/lib/functions/hexdump.sh +0 -96
- package/dist/lib/functions/hiddenfiles.sh +0 -77
- package/dist/lib/functions/hostinfo.sh +0 -98
- package/dist/lib/functions/hstats.sh +0 -75
- package/dist/lib/functions/httpdebug.sh +0 -113
- package/dist/lib/functions/kebabcase.sh +0 -61
- package/dist/lib/functions/keygen.sh +0 -194
- package/dist/lib/functions/last.sh +0 -112
- package/dist/lib/functions/logout.sh +0 -120
- package/dist/lib/functions/lowercase.sh +0 -61
- package/dist/lib/functions/matrix.sh +0 -216
- package/dist/lib/functions/mount_read_only.sh +0 -11
- package/dist/lib/functions/myproc.sh +0 -9
- package/dist/lib/functions/prependpath.sh +0 -21
- package/dist/lib/functions/ql.sh +0 -9
- package/dist/lib/functions/rd.sh +0 -17
- package/dist/lib/functions/remove_disk.sh +0 -11
- package/dist/lib/functions/ren.sh +0 -73
- package/dist/lib/functions/sentencecase.sh +0 -63
- package/dist/lib/functions/showhiddenfiles.sh +0 -14
- package/dist/lib/functions/size.sh +0 -16
- package/dist/lib/functions/snakecase.sh +0 -61
- package/dist/lib/functions/stopwatch.sh +0 -15
- package/dist/lib/functions/sysinfo.sh +0 -145
- package/dist/lib/functions/titlecase.sh +0 -65
- package/dist/lib/functions/uppercase.sh +0 -61
- package/dist/lib/functions/view-source.sh +0 -9
- package/dist/lib/functions/vscode.sh +0 -32
- package/dist/lib/functions/whoisport.sh +0 -14
- package/dist/lib/functions/zipf.sh +0 -16
- package/dist/lib/functions.sh +0 -46
- package/dist/lib/history.sh +0 -90
- package/dist/lib/paths/README.md +0 -52
- package/dist/lib/paths/custom.paths.sh +0 -40
- package/dist/lib/paths/default.paths.sh +0 -37
- package/dist/lib/paths.sh +0 -46
- package/dist/scripts/backup.sh +0 -95
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
|
|
3
|
-
################################################################################
|
|
4
|
-
# 🅳🅾🆃🅵🅸🅻🅴🆂 - Cross-Platform Backup Utility (backup)
|
|
5
|
-
# Made with ♥ by Sebastien Rousseau
|
|
6
|
-
# License: MIT
|
|
7
|
-
#
|
|
8
|
-
# Description:
|
|
9
|
-
# backup is a utility that creates timestamped backups of files and directories.
|
|
10
|
-
# It can automatically compress large backups and maintains a configurable
|
|
11
|
-
# backup history.
|
|
12
|
-
#
|
|
13
|
-
# Usage:
|
|
14
|
-
# backup [--max-size SIZE] [--keep N] <file_or_directory> [<file_or_directory> ...]
|
|
15
|
-
#
|
|
16
|
-
# Arguments:
|
|
17
|
-
# <file_or_directory> One or more file or directory paths to back up.
|
|
18
|
-
#
|
|
19
|
-
# Options:
|
|
20
|
-
# --max-size SIZE Maximum uncompressed backup size before compression.
|
|
21
|
-
# Uses 'M' for megabytes, 'K' for kilobytes, or no suffix
|
|
22
|
-
# for bytes. Default is '100M' (100 megabytes).
|
|
23
|
-
#
|
|
24
|
-
# --keep N Number of most recent backups to keep. Older backups
|
|
25
|
-
# are removed. Default is 5.
|
|
26
|
-
#
|
|
27
|
-
# Notes:
|
|
28
|
-
# - Backups are stored in a 'backups' directory in the current working directory.
|
|
29
|
-
# Adjust the BACKUP_DIR variable if needed.
|
|
30
|
-
# - The script creates a timestamped tar archive for the backup.
|
|
31
|
-
# - If the tar archive exceeds --max-size, it will be compressed with gzip.
|
|
32
|
-
################################################################################
|
|
33
|
-
|
|
34
|
-
backup() {
|
|
35
|
-
# Default configuration
|
|
36
|
-
BACKUP_DIR="${BACKUP_DIR:-./backups}"
|
|
37
|
-
MAX_SIZE="100M" # Default max size before compression
|
|
38
|
-
KEEP=5 # Default number of backups to keep
|
|
39
|
-
|
|
40
|
-
# Parse arguments
|
|
41
|
-
while [[ "$#" -gt 0 ]]; do
|
|
42
|
-
case "$1" in
|
|
43
|
-
--max-size)
|
|
44
|
-
MAX_SIZE="$2"
|
|
45
|
-
shift 2
|
|
46
|
-
;;
|
|
47
|
-
--keep)
|
|
48
|
-
KEEP="$2"
|
|
49
|
-
shift 2
|
|
50
|
-
;;
|
|
51
|
-
-*)
|
|
52
|
-
echo "[ERROR] Unknown option: $1" >&2
|
|
53
|
-
return 1
|
|
54
|
-
;;
|
|
55
|
-
*)
|
|
56
|
-
# Once we hit a non-option, break to treat all remaining as files/dirs
|
|
57
|
-
break
|
|
58
|
-
;;
|
|
59
|
-
esac
|
|
60
|
-
done
|
|
61
|
-
|
|
62
|
-
# Ensure at least one file or directory is provided
|
|
63
|
-
if [[ "$#" -lt 1 ]]; then
|
|
64
|
-
echo "[ERROR] Please provide at least one file or directory to back up." >&2
|
|
65
|
-
return 1
|
|
66
|
-
fi
|
|
67
|
-
|
|
68
|
-
# Create backup directory if it doesn't exist
|
|
69
|
-
if [[ ! -d "$BACKUP_DIR" ]]; then
|
|
70
|
-
mkdir -p "$BACKUP_DIR"
|
|
71
|
-
fi
|
|
72
|
-
|
|
73
|
-
# Generate a timestamp for the backup filename
|
|
74
|
-
TIMESTAMP=$(date +"%Y%m%d_%H%M%S")
|
|
75
|
-
|
|
76
|
-
# Construct a temporary tar archive name (uncompressed)
|
|
77
|
-
TAR_NAME="backup_${TIMESTAMP}.tar"
|
|
78
|
-
TAR_PATH="${BACKUP_DIR}/${TAR_NAME}"
|
|
79
|
-
|
|
80
|
-
# Create the tar archive
|
|
81
|
-
if tar cf "${TAR_PATH}" "$@"; then
|
|
82
|
-
echo "[INFO] Created backup archive '${TAR_PATH}'."
|
|
83
|
-
else
|
|
84
|
-
echo "[ERROR] Failed to create the backup archive." >&2
|
|
85
|
-
return 1
|
|
86
|
-
fi
|
|
87
|
-
|
|
88
|
-
# Convert MAX_SIZE to bytes for comparison
|
|
89
|
-
convert_size_to_bytes() {
|
|
90
|
-
local size_str="$1"
|
|
91
|
-
local num="${size_str//[!0-9]/}"
|
|
92
|
-
local unit=$(echo "${size_str}" | sed 's/[0-9]//g' | tr '[:upper:]' '[:lower:]')
|
|
93
|
-
|
|
94
|
-
case "$unit" in
|
|
95
|
-
m) echo $((num * 1024 * 1024)) ;;
|
|
96
|
-
k) echo $((num * 1024)) ;;
|
|
97
|
-
"") echo "${num}" ;; # No unit means bytes
|
|
98
|
-
*)
|
|
99
|
-
echo "[ERROR] Invalid unit in --max-size. Use M for megabytes, K for kilobytes, or no unit for bytes." >&2
|
|
100
|
-
return 1
|
|
101
|
-
;;
|
|
102
|
-
esac
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
MAX_BYTES=$(convert_size_to_bytes "$MAX_SIZE")
|
|
106
|
-
[[ $? -ne 0 ]] && return 1
|
|
107
|
-
|
|
108
|
-
# Get file size in bytes using wc -c
|
|
109
|
-
FILE_SIZE=$(wc -c < "${TAR_PATH}")
|
|
110
|
-
|
|
111
|
-
if (( FILE_SIZE > MAX_BYTES )); then
|
|
112
|
-
# Compress the backup
|
|
113
|
-
if gzip "${TAR_PATH}"; then
|
|
114
|
-
COMPRESSED_PATH="${TAR_PATH}.gz"
|
|
115
|
-
echo "[INFO] Backup exceeded ${MAX_SIZE}. Compressed to '${COMPRESSED_PATH}'."
|
|
116
|
-
else
|
|
117
|
-
echo "[ERROR] Failed to compress the backup." >&2
|
|
118
|
-
return 1
|
|
119
|
-
fi
|
|
120
|
-
else
|
|
121
|
-
COMPRESSED_PATH="${TAR_PATH}"
|
|
122
|
-
echo "[INFO] No compression required."
|
|
123
|
-
fi
|
|
124
|
-
|
|
125
|
-
# Enforce backup retention
|
|
126
|
-
BACKUPS=($(ls -1t "${BACKUP_DIR}"/backup_*.tar* 2>/dev/null))
|
|
127
|
-
BACKUP_COUNT=${#BACKUPS[@]}
|
|
128
|
-
|
|
129
|
-
# Only attempt removal if we actually have more backups than KEEP
|
|
130
|
-
if (( BACKUP_COUNT > KEEP )); then
|
|
131
|
-
REMOVE_COUNT=$((BACKUP_COUNT - KEEP))
|
|
132
|
-
OLD_BACKUPS=("${BACKUPS[@]:$KEEP:$REMOVE_COUNT}")
|
|
133
|
-
for old_backup in "${OLD_BACKUPS[@]}"; do
|
|
134
|
-
if rm -f "$old_backup"; then
|
|
135
|
-
echo "[INFO] Removed old backup '$old_backup'."
|
|
136
|
-
else
|
|
137
|
-
echo "[ERROR] Failed to remove old backup '$old_backup'." >&2
|
|
138
|
-
fi
|
|
139
|
-
done
|
|
140
|
-
fi
|
|
141
|
-
|
|
142
|
-
echo "[INFO] Backup completed successfully. Current backups stored in '${BACKUP_DIR}'."
|
|
143
|
-
}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
|
|
3
|
-
################################################################################
|
|
4
|
-
# 🅳🅾🆃🅵🅸🅻🅴🆂 - Change Directory and List Contents (cdls)
|
|
5
|
-
# Made with ♥ by Sebastien Rousseau
|
|
6
|
-
# License: MIT
|
|
7
|
-
#
|
|
8
|
-
# Description:
|
|
9
|
-
# cdls is a simple function that combines the functionality of `cd` and `ls`.
|
|
10
|
-
# When called, it changes the current working directory and immediately lists
|
|
11
|
-
# the contents of the new directory.
|
|
12
|
-
#
|
|
13
|
-
# Usage:
|
|
14
|
-
# cdls [directory]
|
|
15
|
-
# cdls --help
|
|
16
|
-
#
|
|
17
|
-
# Arguments:
|
|
18
|
-
# directory The directory to change to. If omitted, changes to the home
|
|
19
|
-
# directory (default behavior of `cd`).
|
|
20
|
-
# --help Displays this help menu and exits.
|
|
21
|
-
#
|
|
22
|
-
# Examples:
|
|
23
|
-
# cdls /tmp # Changes to the /tmp directory and lists its contents.
|
|
24
|
-
# cdls # Changes to the home directory and lists its contents.
|
|
25
|
-
# cdls --help # Displays the help menu.
|
|
26
|
-
#
|
|
27
|
-
################################################################################
|
|
28
|
-
|
|
29
|
-
# Function to combine cd and ls
|
|
30
|
-
cdls() {
|
|
31
|
-
# Display help menu
|
|
32
|
-
if [[ "$1" == "--help" ]]; then
|
|
33
|
-
echo "cdls: Change Directory and List Contents"
|
|
34
|
-
echo
|
|
35
|
-
echo "Usage:"
|
|
36
|
-
echo " cdls [directory]"
|
|
37
|
-
echo " cdls --help"
|
|
38
|
-
echo
|
|
39
|
-
echo "Aliases:"
|
|
40
|
-
echo " alias cdl='cdls' # Alias for cdls to simplify usage"
|
|
41
|
-
echo
|
|
42
|
-
echo "Arguments:"
|
|
43
|
-
echo " directory The directory to change to. If omitted, changes to the home"
|
|
44
|
-
echo " directory (default behavior of \`cd\`)."
|
|
45
|
-
echo " --help Displays this help menu and exits."
|
|
46
|
-
echo
|
|
47
|
-
echo "Examples:"
|
|
48
|
-
echo " cdls /tmp # Changes to the /tmp directory and lists its contents."
|
|
49
|
-
echo " cdls # Changes to the home directory and lists its contents."
|
|
50
|
-
echo " cdls --help # Displays the help menu."
|
|
51
|
-
echo
|
|
52
|
-
return 0
|
|
53
|
-
fi
|
|
54
|
-
|
|
55
|
-
# Change to the specified directory and list its contents
|
|
56
|
-
cd "$@" && ls
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
# Alias for convenience
|
|
60
|
-
alias cdl='cdls' # Alias for cdls to simplify usage
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
|
|
3
|
-
################################################################################
|
|
4
|
-
# 🅳🅾🆃🅵🅸🅻🅴🆂 - Curl Header Viewer (curlheader)
|
|
5
|
-
# Made with ♥ by Sebastien Rousseau
|
|
6
|
-
# License: MIT
|
|
7
|
-
#
|
|
8
|
-
# Description:
|
|
9
|
-
# curlheader is a function to fetch and display HTTP headers for a given URL.
|
|
10
|
-
# It can either display all headers or filter for a specific header by name.
|
|
11
|
-
#
|
|
12
|
-
# Usage:
|
|
13
|
-
# curlheader [header] [url]
|
|
14
|
-
# curlheader --help
|
|
15
|
-
#
|
|
16
|
-
# Arguments:
|
|
17
|
-
# header The specific HTTP header to filter and display (optional).
|
|
18
|
-
# url The URL for which to fetch headers.
|
|
19
|
-
# --help Displays this help menu and exits.
|
|
20
|
-
#
|
|
21
|
-
# Examples:
|
|
22
|
-
# curlheader https://example.com
|
|
23
|
-
# # Fetch and display all headers for the given URL.
|
|
24
|
-
#
|
|
25
|
-
# curlheader Content-Type https://example.com
|
|
26
|
-
# # Fetch and display only the Content-Type header for the given URL.
|
|
27
|
-
#
|
|
28
|
-
# curlheader --help
|
|
29
|
-
# # Displays the help menu.
|
|
30
|
-
#
|
|
31
|
-
################################################################################
|
|
32
|
-
|
|
33
|
-
# Function to fetch and display HTTP headers
|
|
34
|
-
curlheader() {
|
|
35
|
-
# Display help menu
|
|
36
|
-
if [[ "$1" == "--help" ]]; then
|
|
37
|
-
echo "curlheader: Curl Header Viewer"
|
|
38
|
-
echo
|
|
39
|
-
echo "Usage:"
|
|
40
|
-
echo " curlheader [header] [url]"
|
|
41
|
-
echo " curlheader --help"
|
|
42
|
-
echo
|
|
43
|
-
echo "Arguments:"
|
|
44
|
-
echo " header The specific HTTP header to filter and display (optional)."
|
|
45
|
-
echo " url The URL for which to fetch headers."
|
|
46
|
-
echo " --help Displays this help menu and exits."
|
|
47
|
-
echo
|
|
48
|
-
echo "Aliases:"
|
|
49
|
-
echo " alias chd='curlheader' # Alias for curlheader"
|
|
50
|
-
echo " alias chdr='curlheader' # Alias for curlheader"
|
|
51
|
-
echo
|
|
52
|
-
echo "Examples:"
|
|
53
|
-
echo " curlheader https://example.com"
|
|
54
|
-
echo " # Fetch and display all headers for the given URL."
|
|
55
|
-
echo
|
|
56
|
-
echo " curlheader Content-Type https://example.com"
|
|
57
|
-
echo " # Fetch and display only the Content-Type header for the given URL."
|
|
58
|
-
echo
|
|
59
|
-
echo " curlheader --help"
|
|
60
|
-
echo " # Displays the help menu."
|
|
61
|
-
echo
|
|
62
|
-
return 0
|
|
63
|
-
fi
|
|
64
|
-
|
|
65
|
-
# Check if only a URL is provided
|
|
66
|
-
if [[ -z "$2" ]]; then
|
|
67
|
-
echo "Fetching all headers for URL: $1"
|
|
68
|
-
curl -k -s -D - "$1" -o /dev/null
|
|
69
|
-
else
|
|
70
|
-
# Fetch and filter for a specific header
|
|
71
|
-
echo "Fetching '$1' header for URL: $2"
|
|
72
|
-
curl -k -s -D - "$2" -o /dev/null | grep -i "$1:"
|
|
73
|
-
fi
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
# Aliases for convenience
|
|
77
|
-
alias chd='curlheader' # Alias for curlheader
|
|
78
|
-
alias chdr='curlheader' # Alias for curlheader
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
|
|
3
|
-
################################################################################
|
|
4
|
-
# 🅳🅾🆃🅵🅸🅻🅴🆂 - Curl HTTP Status Code Viewer (curlstatus)
|
|
5
|
-
# Made with ♥ by Sebastien Rousseau
|
|
6
|
-
# License: MIT
|
|
7
|
-
#
|
|
8
|
-
# Description:
|
|
9
|
-
# curlstatus is a function to fetch and display the HTTP status code for a
|
|
10
|
-
# given URL. It uses curl to make a request and extracts the HTTP status
|
|
11
|
-
# code.
|
|
12
|
-
#
|
|
13
|
-
# Usage:
|
|
14
|
-
# curlstatus [url]
|
|
15
|
-
# curlstatus --help
|
|
16
|
-
#
|
|
17
|
-
# Arguments:
|
|
18
|
-
# url The URL for which to fetch the HTTP status code.
|
|
19
|
-
# --help Displays this help menu and exits.
|
|
20
|
-
#
|
|
21
|
-
# Examples:
|
|
22
|
-
# curlstatus https://example.com
|
|
23
|
-
# # Fetch and display the HTTP status code for the given URL.
|
|
24
|
-
#
|
|
25
|
-
# curlstatus --help
|
|
26
|
-
# # Displays the help menu.
|
|
27
|
-
#
|
|
28
|
-
################################################################################
|
|
29
|
-
|
|
30
|
-
# Function to fetch and display HTTP status code
|
|
31
|
-
curlstatus() {
|
|
32
|
-
# Display help menu
|
|
33
|
-
if [[ "$1" == "--help" ]]; then
|
|
34
|
-
echo "curlstatus: Curl HTTP Status Code Viewer"
|
|
35
|
-
echo
|
|
36
|
-
echo "Usage:"
|
|
37
|
-
echo " curlstatus [url]"
|
|
38
|
-
echo " curlstatus --help"
|
|
39
|
-
echo
|
|
40
|
-
echo "Aliases:"
|
|
41
|
-
echo " alias cs='curlstatus' # Alias for curlstatus"
|
|
42
|
-
echo " alias cst='curlstatus' # Alias for curlstatus"
|
|
43
|
-
echo " alias httpcode='curlstatus' # Alias for curlstatus"
|
|
44
|
-
echo
|
|
45
|
-
echo "Arguments:"
|
|
46
|
-
echo " url The URL for which to fetch the HTTP status code."
|
|
47
|
-
echo " --help Displays this help menu and exits."
|
|
48
|
-
echo
|
|
49
|
-
echo "Examples:"
|
|
50
|
-
echo " curlstatus https://example.com"
|
|
51
|
-
echo " # Fetch and display the HTTP status code for the given URL."
|
|
52
|
-
echo
|
|
53
|
-
echo " curlstatus --help"
|
|
54
|
-
echo " # Displays the help menu."
|
|
55
|
-
echo
|
|
56
|
-
return 0
|
|
57
|
-
fi
|
|
58
|
-
|
|
59
|
-
# Check if a URL is provided
|
|
60
|
-
if [[ -z "$1" ]]; then
|
|
61
|
-
echo "[ERROR] No URL provided. Use 'curlstatus --help' for usage information." >&2
|
|
62
|
-
return 1
|
|
63
|
-
fi
|
|
64
|
-
|
|
65
|
-
# Fetch and display the HTTP status code
|
|
66
|
-
echo "Fetching HTTP status code for URL: $1"
|
|
67
|
-
curl -k -s -o /dev/null -w "%{http_code}" "$1"
|
|
68
|
-
echo
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
# Aliases for convenience
|
|
72
|
-
alias cs='curlstatus' # Alias for curlstatus
|
|
73
|
-
alias cst='curlstatus' # Alias for curlstatus
|
|
74
|
-
alias httpcode='curlstatus' # Alias for curlstatus
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
|
|
3
|
-
################################################################################
|
|
4
|
-
# 🅳🅾🆃🅵🅸🅻🅴🆂 - Curl Timing Viewer (curltime)
|
|
5
|
-
# Made with ♥ by Sebastien Rousseau
|
|
6
|
-
# License: MIT
|
|
7
|
-
#
|
|
8
|
-
# Description:
|
|
9
|
-
# curltime is a function that measures and displays various timing metrics for
|
|
10
|
-
# an HTTP request made to a given URL using `curl`. It provides detailed
|
|
11
|
-
# information on DNS resolution time, connection time, and total transfer time.
|
|
12
|
-
#
|
|
13
|
-
# Usage:
|
|
14
|
-
# curltime [url]
|
|
15
|
-
# curltime --help
|
|
16
|
-
#
|
|
17
|
-
# Arguments:
|
|
18
|
-
# url The URL for which to fetch timing metrics.
|
|
19
|
-
# --help Displays this help menu and exits.
|
|
20
|
-
#
|
|
21
|
-
# Examples:
|
|
22
|
-
# curltime https://example.com
|
|
23
|
-
# # Displays the timing metrics for the given URL.
|
|
24
|
-
#
|
|
25
|
-
# curltime --help
|
|
26
|
-
# # Displays the help menu.
|
|
27
|
-
#
|
|
28
|
-
################################################################################
|
|
29
|
-
|
|
30
|
-
# Function to display timing metrics for a given URL
|
|
31
|
-
curltime() {
|
|
32
|
-
# Display help menu
|
|
33
|
-
if [[ "$1" == "--help" ]]; then
|
|
34
|
-
echo "curltime: Curl Timing Viewer"
|
|
35
|
-
echo
|
|
36
|
-
echo "Usage:"
|
|
37
|
-
echo " curltime [url]"
|
|
38
|
-
echo " curltime --help"
|
|
39
|
-
echo
|
|
40
|
-
echo "Arguments:"
|
|
41
|
-
echo " url The URL for which to fetch timing metrics."
|
|
42
|
-
echo " --help Displays this help menu and exits."
|
|
43
|
-
echo
|
|
44
|
-
echo "Examples:"
|
|
45
|
-
echo " curltime https://example.com"
|
|
46
|
-
echo " # Displays the timing metrics for the given URL."
|
|
47
|
-
echo
|
|
48
|
-
echo " curltime --help"
|
|
49
|
-
echo " # Displays the help menu."
|
|
50
|
-
echo
|
|
51
|
-
return 0
|
|
52
|
-
fi
|
|
53
|
-
|
|
54
|
-
# Check if a URL is provided
|
|
55
|
-
if [[ -z "$1" ]]; then
|
|
56
|
-
echo "[ERROR] No URL provided. Use 'curltime --help' for usage information." >&2
|
|
57
|
-
return 1
|
|
58
|
-
fi
|
|
59
|
-
|
|
60
|
-
# Fetch and display timing metrics for the URL
|
|
61
|
-
curl -w "\n\
|
|
62
|
-
┌──────────────────────────────┐\n\
|
|
63
|
-
│Time appconnect: %{time_appconnect}s │\n\
|
|
64
|
-
│Time connect: %{time_connect}s │\n\
|
|
65
|
-
│Time namelookup: %{time_namelookup}s │\n\
|
|
66
|
-
│Time pretransfer: %{time_pretransfer}s │\n\
|
|
67
|
-
│Time redirect: %{time_redirect}s │\n\
|
|
68
|
-
│Time starttransfer: %{time_starttransfer}s │\n\
|
|
69
|
-
└──────────────────────────────┘\n\
|
|
70
|
-
Time total: %{time_total}s\n\n" -o /dev/null -s "$1"
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
# Aliases for convenience
|
|
74
|
-
alias cht="curltime" # Alias for curltime
|
|
75
|
-
alias chtm="curltime" # Alias for curltime
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
|
|
3
|
-
################################################################################
|
|
4
|
-
# 🅳🅾🆃🅵🅸🅻🅴🆂 - Base64 Encode and Decode (encode64/decode64)
|
|
5
|
-
# Made with ♥ by Sebastien Rousseau
|
|
6
|
-
# License: MIT
|
|
7
|
-
#
|
|
8
|
-
# Description:
|
|
9
|
-
# encode64 and decode64 are functions for encoding and decoding strings to and
|
|
10
|
-
# from base64. These functions can process input either directly as arguments
|
|
11
|
-
# or via standard input (pipe).
|
|
12
|
-
#
|
|
13
|
-
# Usage:
|
|
14
|
-
# encode64 [string]
|
|
15
|
-
# encode64 --help
|
|
16
|
-
#
|
|
17
|
-
# decode64 [base64_string]
|
|
18
|
-
# decode64 --help
|
|
19
|
-
#
|
|
20
|
-
# Arguments:
|
|
21
|
-
# string The string to encode into base64 (optional).
|
|
22
|
-
# base64_string The base64-encoded string to decode (optional).
|
|
23
|
-
# --help Displays the help menu and exits.
|
|
24
|
-
#
|
|
25
|
-
# Examples:
|
|
26
|
-
# echo "Hello World" | encode64
|
|
27
|
-
# # Encodes "Hello World" to base64 via pipe.
|
|
28
|
-
#
|
|
29
|
-
# encode64 "Hello World"
|
|
30
|
-
# # Encodes "Hello World" to base64 directly from arguments.
|
|
31
|
-
#
|
|
32
|
-
# decode64 "SGVsbG8gV29ybGQK"
|
|
33
|
-
# # Decodes the given base64 string to plaintext.
|
|
34
|
-
#
|
|
35
|
-
################################################################################
|
|
36
|
-
|
|
37
|
-
# Function to encode a string to base64
|
|
38
|
-
encode64() {
|
|
39
|
-
# Display help menu
|
|
40
|
-
if [[ "$1" == "--help" ]]; then
|
|
41
|
-
echo "encode64: Encode a string to base64"
|
|
42
|
-
echo
|
|
43
|
-
echo "Usage:"
|
|
44
|
-
echo " encode64 [string]"
|
|
45
|
-
echo " encode64 --help"
|
|
46
|
-
echo
|
|
47
|
-
echo "Arguments:"
|
|
48
|
-
echo " string The string to encode into base64 (optional)."
|
|
49
|
-
echo " --help Displays this help menu and exits."
|
|
50
|
-
echo
|
|
51
|
-
echo "Examples:"
|
|
52
|
-
echo " echo \"Hello World\" | encode64"
|
|
53
|
-
echo " # Encodes \"Hello World\" to base64 via pipe."
|
|
54
|
-
echo
|
|
55
|
-
echo " encode64 \"Hello World\""
|
|
56
|
-
echo " # Encodes \"Hello World\" to base64 directly from arguments."
|
|
57
|
-
echo
|
|
58
|
-
return 0
|
|
59
|
-
fi
|
|
60
|
-
|
|
61
|
-
# Encode input to base64
|
|
62
|
-
if [[ $# -eq 0 ]]; then
|
|
63
|
-
# Process input from stdin
|
|
64
|
-
cat | base64
|
|
65
|
-
else
|
|
66
|
-
# Process input from arguments
|
|
67
|
-
printf '%s' "$1" | base64
|
|
68
|
-
fi
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
# Function to decode a base64 string
|
|
72
|
-
decode64() {
|
|
73
|
-
# Display help menu
|
|
74
|
-
if [[ "$1" == "--help" ]]; then
|
|
75
|
-
echo "decode64: Decode a base64-encoded string"
|
|
76
|
-
echo
|
|
77
|
-
echo "Usage:"
|
|
78
|
-
echo " decode64 [base64_string]"
|
|
79
|
-
echo " decode64 --help"
|
|
80
|
-
echo
|
|
81
|
-
echo "Arguments:"
|
|
82
|
-
echo " base64_string The base64-encoded string to decode (optional)."
|
|
83
|
-
echo " --help Displays this help menu and exits."
|
|
84
|
-
echo
|
|
85
|
-
echo "Examples:"
|
|
86
|
-
echo " echo \"SGVsbG8gV29ybGQK\" | decode64"
|
|
87
|
-
echo " # Decodes the base64 string via pipe."
|
|
88
|
-
echo
|
|
89
|
-
echo " decode64 \"SGVsbG8gV29ybGQK\""
|
|
90
|
-
echo " # Decodes the given base64 string to plaintext."
|
|
91
|
-
echo
|
|
92
|
-
return 0
|
|
93
|
-
fi
|
|
94
|
-
|
|
95
|
-
# Decode input from base64
|
|
96
|
-
if [[ $# -eq 0 ]]; then
|
|
97
|
-
# Process input from stdin
|
|
98
|
-
cat | base64 --decode
|
|
99
|
-
else
|
|
100
|
-
# Process input from arguments
|
|
101
|
-
printf '%s\n' "$1" | base64 --decode
|
|
102
|
-
fi
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
# Aliases for convenience
|
|
106
|
-
alias e64=encode64 # Encode to base64.
|
|
107
|
-
alias d64=decode64 # Decode from base64.
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
|
|
3
|
-
################################################################################
|
|
4
|
-
# 🅳🅾🆃🅵🅸🅻🅴🆂 - Environment Detector (environment)
|
|
5
|
-
# Made with ♥ by Sebastien Rousseau
|
|
6
|
-
# License: MIT
|
|
7
|
-
#
|
|
8
|
-
# Description:
|
|
9
|
-
# environment is a function that detects the current operating system
|
|
10
|
-
# environment. It identifies whether the system is macOS, Linux, or Windows
|
|
11
|
-
# (including Cygwin and MING environments).
|
|
12
|
-
#
|
|
13
|
-
# Usage:
|
|
14
|
-
# environment
|
|
15
|
-
# environment --help
|
|
16
|
-
#
|
|
17
|
-
# Arguments:
|
|
18
|
-
# --help Displays this help menu and exits.
|
|
19
|
-
#
|
|
20
|
-
# Examples:
|
|
21
|
-
# environment
|
|
22
|
-
# # Detects and displays the current operating system environment.
|
|
23
|
-
#
|
|
24
|
-
# environment --help
|
|
25
|
-
# # Displays the help menu.
|
|
26
|
-
#
|
|
27
|
-
################################################################################
|
|
28
|
-
|
|
29
|
-
# Function to detect the current environment
|
|
30
|
-
environment() {
|
|
31
|
-
# Display help menu
|
|
32
|
-
if [[ "$1" == "--help" ]]; then
|
|
33
|
-
echo "environment: Environment Detector"
|
|
34
|
-
echo
|
|
35
|
-
echo "Usage:"
|
|
36
|
-
echo " environment"
|
|
37
|
-
echo " environment --help"
|
|
38
|
-
echo
|
|
39
|
-
echo "Arguments:"
|
|
40
|
-
echo " --help Displays this help menu and exits."
|
|
41
|
-
echo
|
|
42
|
-
echo "Examples:"
|
|
43
|
-
echo " environment"
|
|
44
|
-
echo " # Detects and displays the current operating system environment."
|
|
45
|
-
echo
|
|
46
|
-
echo " environment --help"
|
|
47
|
-
echo " # Displays the help menu."
|
|
48
|
-
echo
|
|
49
|
-
return 0
|
|
50
|
-
fi
|
|
51
|
-
|
|
52
|
-
# Detect the environment
|
|
53
|
-
LOCAL_OS="other" # Fallback OS
|
|
54
|
-
|
|
55
|
-
# macOS
|
|
56
|
-
if [[ "$(uname -s | grep -c Darwin)" -gt 0 ]]; then
|
|
57
|
-
LOCAL_OS="mac"
|
|
58
|
-
|
|
59
|
-
# Linux
|
|
60
|
-
elif [[ "$(uname -s | grep -c Linux)" -gt 0 ]]; then
|
|
61
|
-
LOCAL_OS="linux"
|
|
62
|
-
|
|
63
|
-
# Windows via MING
|
|
64
|
-
elif [[ "$(uname -s | grep -c MING)" -gt 0 ]]; then
|
|
65
|
-
LOCAL_OS="win"
|
|
66
|
-
|
|
67
|
-
# Cygwin
|
|
68
|
-
elif [[ "$(uname -s | grep -c Cygwin)" -gt 0 ]]; then
|
|
69
|
-
LOCAL_OS="win"
|
|
70
|
-
|
|
71
|
-
# Cygwin via Babun
|
|
72
|
-
elif [[ "$(uname -s | grep -c CYGWIN)" -gt 0 ]]; then
|
|
73
|
-
LOCAL_OS="win"
|
|
74
|
-
fi
|
|
75
|
-
|
|
76
|
-
# Output the result
|
|
77
|
-
echo "${LOCAL_OS}"
|
|
78
|
-
}
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
|
|
3
|
-
################################################################################
|
|
4
|
-
# 🅳🅾🆃🅵🅸🅻🅴🆂 - Archive Extractor (extract)
|
|
5
|
-
# Made with ♥ by Sebastien Rousseau
|
|
6
|
-
# License: MIT
|
|
7
|
-
#
|
|
8
|
-
# Description:
|
|
9
|
-
# extract is a function to extract most known archive formats with a single
|
|
10
|
-
# command. It supports various archive types like .tar, .zip, .gz, .7z, and more.
|
|
11
|
-
#
|
|
12
|
-
# Usage:
|
|
13
|
-
# extract [file]
|
|
14
|
-
# extract --help
|
|
15
|
-
#
|
|
16
|
-
# Arguments:
|
|
17
|
-
# file The archive file to extract.
|
|
18
|
-
# --help Displays this help menu and exits.
|
|
19
|
-
#
|
|
20
|
-
# Examples:
|
|
21
|
-
# extract file.tar.gz
|
|
22
|
-
# # Extracts the contents of file.tar.gz.
|
|
23
|
-
#
|
|
24
|
-
# extract archive.zip
|
|
25
|
-
# # Extracts the contents of archive.zip.
|
|
26
|
-
#
|
|
27
|
-
# extract --help
|
|
28
|
-
# # Displays the help menu.
|
|
29
|
-
#
|
|
30
|
-
################################################################################
|
|
31
|
-
|
|
32
|
-
# Function to extract most known archive formats
|
|
33
|
-
extract() {
|
|
34
|
-
# Display help menu
|
|
35
|
-
if [[ "$1" == "--help" ]]; then
|
|
36
|
-
echo "extract: Archive Extractor"
|
|
37
|
-
echo
|
|
38
|
-
echo "Usage:"
|
|
39
|
-
echo " extract [file]"
|
|
40
|
-
echo " extract --help"
|
|
41
|
-
echo
|
|
42
|
-
echo "Arguments:"
|
|
43
|
-
echo " file The archive file to extract."
|
|
44
|
-
echo " --help Displays this help menu and exits."
|
|
45
|
-
echo
|
|
46
|
-
echo "Examples:"
|
|
47
|
-
echo " extract file.tar.gz"
|
|
48
|
-
echo " # Extracts the contents of file.tar.gz."
|
|
49
|
-
echo
|
|
50
|
-
echo " extract archive.zip"
|
|
51
|
-
echo " # Extracts the contents of archive.zip."
|
|
52
|
-
echo
|
|
53
|
-
echo " extract --help"
|
|
54
|
-
echo " # Displays the help menu."
|
|
55
|
-
echo
|
|
56
|
-
return 0
|
|
57
|
-
fi
|
|
58
|
-
|
|
59
|
-
# Validate input
|
|
60
|
-
if [[ "$#" != 1 ]]; then
|
|
61
|
-
echo "[ERROR] Please provide one argument (the archive file to extract)." >&2
|
|
62
|
-
return 1
|
|
63
|
-
fi
|
|
64
|
-
|
|
65
|
-
# Check if the file exists
|
|
66
|
-
if [[ -f "$1" ]]; then
|
|
67
|
-
echo "[INFO] Extracting '$1'..."
|
|
68
|
-
case "$1" in
|
|
69
|
-
*.tar.bz2) tar xjf "$1" ;;
|
|
70
|
-
*.tar.gz) tar xzf "$1" ;;
|
|
71
|
-
*.bz2) bunzip2 "$1" ;;
|
|
72
|
-
*.rar) unrar e "$1" ;;
|
|
73
|
-
*.gz) gunzip "$1" ;;
|
|
74
|
-
*.tar) tar xf "$1" ;;
|
|
75
|
-
*.tbz2) tar xjf "$1" ;;
|
|
76
|
-
*.tgz) tar xzf "$1" ;;
|
|
77
|
-
*.zip) unzip "$1" ;;
|
|
78
|
-
*.Z) uncompress "$1" ;;
|
|
79
|
-
*.7z) 7z x "$1" ;;
|
|
80
|
-
*) echo "[ERROR] '$1' cannot be extracted via extract()." ;;
|
|
81
|
-
esac
|
|
82
|
-
else
|
|
83
|
-
echo "[ERROR] '$1' is not a valid file." >&2
|
|
84
|
-
return 1
|
|
85
|
-
fi
|
|
86
|
-
}
|