safe-rm 3.0.0 → 3.1.0

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/Makefile CHANGED
@@ -12,6 +12,3 @@ uninstall:
12
12
  @echo "Please remove \"alias rm='$(PREFIX)/safe-rm'\" from your ~/.bashrc script"
13
13
  @echo "and do 'unalias rm' from all your terminal sessions"
14
14
  @echo "Successfully removed $(PREFIX)/safe-rm"
15
-
16
- test:
17
- @echo "Testing safe-rm"
package/README.md CHANGED
@@ -14,7 +14,7 @@
14
14
 
15
15
  [Safe-rm][safe-rm], a drop-in and much safer replacement of the unix [`rm`][rm] command with **ALMOST FULL** features of the original [`rm`][rm].
16
16
 
17
- The project was initially developed for Mac OS X, and then tested on Linux.
17
+ The project was initially developed on Mac OS X and has been continuously used by myself since then, with later testing conducted on Linux. If you encounter any issues during use, please feel free to [submit an issue](https://github.com/kaelzhang/shell-safe-rm/issues/new).
18
18
 
19
19
  ## Features
20
20
  - Supports both MacOS and Linux with full test coverage.
@@ -147,7 +147,9 @@ In `~/.safe-rm/config`
147
147
  export SAFE_RM_USE_APPLESCRIPT=no
148
148
  ```
149
149
 
150
- ### Change the Default Trach Bin Other Than System Default
150
+ By default, on MacOS, `safe-rm` uses AppleScript as much as possible so that removed files could be put back from system Trash app.
151
+
152
+ ### Change the Default Trash Bin Other Than System Default
151
153
 
152
154
  ```sh
153
155
  export SAFE_RM_TRASH=/path/to/trash
@@ -190,8 +192,8 @@ $ safe-rm -rf /path/to
190
192
  To keep the performance of `safe-rm` and avoid conducting unnecessary file system traversing, this would not prevent `/path/to/be/protected/foo` from removing.
191
193
 
192
194
  Pay **ATTENTION** that:
193
- - Before adding protected rules, i.e. placing the `.gitignore` inside the `"~/.safe-rm/"` directory, it requires `git` to be installed in your environment
194
- - The protected rules file applies to the root directory (/), which This means that the patterns defined within it need to be relative to the root directory.
195
+ - Before adding protected rules, i.e. placing the `".gitignore"` inside the `"~/.safe-rm/"` directory, it requires `git` to be installed in your environment
196
+ - The `".gitignore"` patterns apply to the root directory (`"/"`), which means that the patterns defined within it need to be relative to the root directory.
195
197
  - Avoid adding `/` in the protected rules file, or everything will be protected
196
198
 
197
199
 
package/bin/rm.sh CHANGED
@@ -3,20 +3,27 @@
3
3
  # Basic configuration
4
4
  # ------------------------------------------------------------------------------
5
5
 
6
- DEFAULT_SAFE_RM_CONFIG="$HOME/.safe-rm/config"
6
+ # You could modify the root config directory of safe-rm by using
7
+ # ```sh
8
+ # $ export SAFE_RM_CONFIG_ROOT=/path/to/safe-rm-config
9
+ # ```
10
+ if [[ -n $XDG_CONFIG_HOME && -d "$XDG_CONFIG_HOME/safe-rm" ]]; then
11
+ # If XDG_CONFIG_HOME is set, use it as the configuration root
12
+ SAFE_RM_CONFIG_ROOT=${SAFE_RM_CONFIG_ROOT:="$XDG_CONFIG_HOME/safe-rm"}
13
+ else
14
+ SAFE_RM_CONFIG_ROOT=${SAFE_RM_CONFIG_ROOT:="$HOME/.safe-rm"}
15
+ fi
7
16
 
8
17
  # You could modify the location of the configuration file by using
9
18
  # ```sh
10
19
  # $ export SAFE_RM_CONFIG=/path/to/safe-rm.conf
11
20
  # ```
12
- SAFE_RM_CONFIG=${SAFE_RM_CONFIG:="$DEFAULT_SAFE_RM_CONFIG"}
21
+ SAFE_RM_CONFIG=${SAFE_RM_CONFIG:="$SAFE_RM_CONFIG_ROOT/config"}
13
22
 
14
23
  if [[ -f "$SAFE_RM_CONFIG" ]]; then
15
24
  source "$SAFE_RM_CONFIG"
16
25
  fi
17
26
 
18
- SAFE_RM_CONFIG_ROOT=${SAFE_RM_CONFIG_ROOT:="$HOME/.safe-rm"}
19
-
20
27
  # Print debug info or not
21
28
  SAFE_RM_DEBUG=${SAFE_RM_DEBUG:=}
22
29
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "safe-rm",
3
- "version": "3.0.0",
3
+ "version": "3.1.0",
4
4
  "description": "A much safer replacement of bash rm with nearly full functionalities and options of the rm command!",
5
5
  "bin": {
6
6
  "safe-rm": "./bin/rm.sh"