extra-cd.sh 1.1.2 → 1.1.3
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/LICENSE +21 -21
- package/README.md +58 -58
- package/index.sh +47 -47
- package/package.json +41 -39
- package/index.cmd +0 -36
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2018-22 Subhajit Sahu
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2018-22 Subhajit Sahu
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,58 +1,58 @@
|
|
|
1
|
-
Change the working directory, with shortcuts and listing.<br>
|
|
2
|
-
🐚 [Shell](https://www.npmjs.com/package/extra-cd.sh),
|
|
3
|
-
🖥️ [Command prompt](https://www.npmjs.com/package/extra-cd.cmd),
|
|
4
|
-
📜 [Files](https://unpkg.com/extra-cd.sh/).
|
|
5
|
-
|
|
6
|
-
> Stability: [Experimental](https://www.youtube.com/watch?v=L1j93RnIxEo).
|
|
7
|
-
|
|
8
|
-
```bash
|
|
9
|
-
# Install on Linux
|
|
10
|
-
$ npm install -g extra-cd.sh
|
|
11
|
-
$ source $(where extra-cd)
|
|
12
|
-
|
|
13
|
-
# Install on Windows
|
|
14
|
-
$ npm install -g extra-cd.cmd
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
```bash
|
|
18
|
-
$ ecd [-] [+/-/=<shortcut>] [path]
|
|
19
|
-
# [] -> optional argument
|
|
20
|
-
# <> -> argument value
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
# Change to workspace directory
|
|
24
|
-
$ ecd /local/mnt/workspace
|
|
25
|
-
|
|
26
|
-
# Change to up one directory
|
|
27
|
-
$ ecd ..
|
|
28
|
-
|
|
29
|
-
# Stay at current directory (list contents)
|
|
30
|
-
$ ecd .
|
|
31
|
-
|
|
32
|
-
# Change to previous directory
|
|
33
|
-
$ ecd -
|
|
34
|
-
|
|
35
|
-
# Add current directory as shortcut
|
|
36
|
-
$ ecd +work
|
|
37
|
-
|
|
38
|
-
# Change to root directory
|
|
39
|
-
$ ecd /
|
|
40
|
-
|
|
41
|
-
# Change to workspace directory using shortcut
|
|
42
|
-
$ ecd =work
|
|
43
|
-
|
|
44
|
-
# Remove workspace shortcut
|
|
45
|
-
$ ecd -work
|
|
46
|
-
|
|
47
|
-
# Add relative path shortcut
|
|
48
|
-
$ ecd +up3 ../../..
|
|
49
|
-
|
|
50
|
-
# Go up 3 directories
|
|
51
|
-
$ ecd =up3
|
|
52
|
-
|
|
53
|
-
# Remove relative path shortcut
|
|
54
|
-
$ ecd -up3
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
[](https://merferry.github.io)
|
|
1
|
+
Change the working directory, with shortcuts and listing.<br>
|
|
2
|
+
🐚 [Shell](https://www.npmjs.com/package/extra-cd.sh),
|
|
3
|
+
🖥️ [Command prompt](https://www.npmjs.com/package/extra-cd.cmd),
|
|
4
|
+
📜 [Files](https://unpkg.com/extra-cd.sh/).
|
|
5
|
+
|
|
6
|
+
> Stability: [Experimental](https://www.youtube.com/watch?v=L1j93RnIxEo).
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
# Install on Linux
|
|
10
|
+
$ npm install -g extra-cd.sh
|
|
11
|
+
$ source $(where extra-cd)
|
|
12
|
+
|
|
13
|
+
# Install on Windows
|
|
14
|
+
$ npm install -g extra-cd.cmd
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
$ ecd [-] [+/-/=<shortcut>] [path]
|
|
19
|
+
# [] -> optional argument
|
|
20
|
+
# <> -> argument value
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
# Change to workspace directory
|
|
24
|
+
$ ecd /local/mnt/workspace
|
|
25
|
+
|
|
26
|
+
# Change to up one directory
|
|
27
|
+
$ ecd ..
|
|
28
|
+
|
|
29
|
+
# Stay at current directory (list contents)
|
|
30
|
+
$ ecd .
|
|
31
|
+
|
|
32
|
+
# Change to previous directory
|
|
33
|
+
$ ecd -
|
|
34
|
+
|
|
35
|
+
# Add current directory as shortcut
|
|
36
|
+
$ ecd +work
|
|
37
|
+
|
|
38
|
+
# Change to root directory
|
|
39
|
+
$ ecd /
|
|
40
|
+
|
|
41
|
+
# Change to workspace directory using shortcut
|
|
42
|
+
$ ecd =work
|
|
43
|
+
|
|
44
|
+
# Remove workspace shortcut
|
|
45
|
+
$ ecd -work
|
|
46
|
+
|
|
47
|
+
# Add relative path shortcut
|
|
48
|
+
$ ecd +up3 ../../..
|
|
49
|
+
|
|
50
|
+
# Go up 3 directories
|
|
51
|
+
$ ecd =up3
|
|
52
|
+
|
|
53
|
+
# Remove relative path shortcut
|
|
54
|
+
$ ecd -up3
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
[](https://merferry.github.io)
|
package/index.sh
CHANGED
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
|
|
3
|
-
# Get present script directory.
|
|
4
|
-
# - https://stackoverflow.com/a/246128/1413259
|
|
5
|
-
psd() {
|
|
6
|
-
z="${BASH_SOURCE[0]}"
|
|
7
|
-
if [ -h "$z" ]; then z="$(readlink "$z")"; fi
|
|
8
|
-
cd "$(dirname "$0")" && cd "$(dirname "$z")" && pwd
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
# Change the working directory, with shortcuts and listing.
|
|
13
|
-
extra-cd() {
|
|
14
|
-
# Setup config directory
|
|
15
|
-
local d="$HOME/.config/npm/extra-cd"
|
|
16
|
-
mkdir -p "$d"
|
|
17
|
-
|
|
18
|
-
# Process arguments
|
|
19
|
-
local l="0"
|
|
20
|
-
local a="$1"
|
|
21
|
-
local c="${a:0:1}"
|
|
22
|
-
local f="$d/${a:1}.txt"
|
|
23
|
-
if [[ "$1" == "--help" ]]; then
|
|
24
|
-
less "$(psd)/README.md"
|
|
25
|
-
elif [[ "$1" == "-" ]]; then
|
|
26
|
-
l="1" && popd > /dev/null
|
|
27
|
-
elif [[ "$c" == "+" ]]; then
|
|
28
|
-
if [[ "$2" == "" ]]; then pwd > "$f"; else echo "$2" > "$f"; fi
|
|
29
|
-
elif [[ "$c" == "-" ]]; then
|
|
30
|
-
rm -f "$f"
|
|
31
|
-
elif [[ "$c" == "=" ]]; then
|
|
32
|
-
l="1" && pushd $(cat "$f") > /dev/null
|
|
33
|
-
else
|
|
34
|
-
l="1" && pushd "$1" > /dev/null
|
|
35
|
-
fi
|
|
36
|
-
|
|
37
|
-
# List directory
|
|
38
|
-
if [[ "$l" == "1" ]]; then
|
|
39
|
-
ls --color --group-directories-first && echo
|
|
40
|
-
fi
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
# Change the working directory, with shortcuts and listing.
|
|
45
|
-
ecd() {
|
|
46
|
-
extra-cd "$@"
|
|
47
|
-
}
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
|
|
3
|
+
# Get present script directory.
|
|
4
|
+
# - https://stackoverflow.com/a/246128/1413259
|
|
5
|
+
psd() {
|
|
6
|
+
z="${BASH_SOURCE[0]}"
|
|
7
|
+
if [ -h "$z" ]; then z="$(readlink "$z")"; fi
|
|
8
|
+
cd "$(dirname "$0")" && cd "$(dirname "$z")" && pwd
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
# Change the working directory, with shortcuts and listing.
|
|
13
|
+
extra-cd() {
|
|
14
|
+
# Setup config directory
|
|
15
|
+
local d="$HOME/.config/npm/extra-cd"
|
|
16
|
+
mkdir -p "$d"
|
|
17
|
+
|
|
18
|
+
# Process arguments
|
|
19
|
+
local l="0"
|
|
20
|
+
local a="$1"
|
|
21
|
+
local c="${a:0:1}"
|
|
22
|
+
local f="$d/${a:1}.txt"
|
|
23
|
+
if [[ "$1" == "--help" ]]; then
|
|
24
|
+
less "$(psd)/README.md"
|
|
25
|
+
elif [[ "$1" == "-" ]]; then
|
|
26
|
+
l="1" && popd > /dev/null
|
|
27
|
+
elif [[ "$c" == "+" ]]; then
|
|
28
|
+
if [[ "$2" == "" ]]; then pwd > "$f"; else echo "$2" > "$f"; fi
|
|
29
|
+
elif [[ "$c" == "-" ]]; then
|
|
30
|
+
rm -f "$f"
|
|
31
|
+
elif [[ "$c" == "=" ]]; then
|
|
32
|
+
l="1" && pushd $(cat "$f") > /dev/null
|
|
33
|
+
else
|
|
34
|
+
l="1" && pushd "$1" > /dev/null
|
|
35
|
+
fi
|
|
36
|
+
|
|
37
|
+
# List directory
|
|
38
|
+
if [[ "$l" == "1" ]]; then
|
|
39
|
+
ls --color --group-directories-first && echo
|
|
40
|
+
fi
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
# Change the working directory, with shortcuts and listing.
|
|
45
|
+
ecd() {
|
|
46
|
+
extra-cd "$@"
|
|
47
|
+
}
|
package/package.json
CHANGED
|
@@ -1,39 +1,41 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "extra-cd.sh",
|
|
3
|
-
"version": "1.1.
|
|
4
|
-
"description": "Change the working directory, with shortcuts and listing.",
|
|
5
|
-
"preferGlobal": true,
|
|
6
|
-
"main": "index.sh",
|
|
7
|
-
"bin": {
|
|
8
|
-
"extra-cd": "index.sh",
|
|
9
|
-
"ecd": "index.sh"
|
|
10
|
-
},
|
|
11
|
-
"scripts": {
|
|
12
|
-
"test": "exit",
|
|
13
|
-
"build": "node ./build.js",
|
|
14
|
-
"deploy": "node ./build.js deploy"
|
|
15
|
-
},
|
|
16
|
-
"keywords": [
|
|
17
|
-
"extra",
|
|
18
|
-
"cd",
|
|
19
|
-
"change",
|
|
20
|
-
"directory",
|
|
21
|
-
"cli",
|
|
22
|
-
"command",
|
|
23
|
-
"line",
|
|
24
|
-
"interface"
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
"
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "extra-cd.sh",
|
|
3
|
+
"version": "1.1.3",
|
|
4
|
+
"description": "Change the working directory, with shortcuts and listing.",
|
|
5
|
+
"preferGlobal": true,
|
|
6
|
+
"main": "index.sh",
|
|
7
|
+
"bin": {
|
|
8
|
+
"extra-cd": "index.sh",
|
|
9
|
+
"ecd": "index.sh"
|
|
10
|
+
},
|
|
11
|
+
"scripts": {
|
|
12
|
+
"test": "exit",
|
|
13
|
+
"build": "node ./build.js",
|
|
14
|
+
"deploy": "node ./build.js deploy"
|
|
15
|
+
},
|
|
16
|
+
"keywords": [
|
|
17
|
+
"extra",
|
|
18
|
+
"cd",
|
|
19
|
+
"change",
|
|
20
|
+
"directory",
|
|
21
|
+
"cli",
|
|
22
|
+
"command",
|
|
23
|
+
"line",
|
|
24
|
+
"interface",
|
|
25
|
+
"shell",
|
|
26
|
+
"bash"
|
|
27
|
+
],
|
|
28
|
+
"author": "wolfram77@gmail.com",
|
|
29
|
+
"license": "MIT",
|
|
30
|
+
"repository": {
|
|
31
|
+
"type": "git",
|
|
32
|
+
"url": "git+https://github.com/nodef/extra-cd.git"
|
|
33
|
+
},
|
|
34
|
+
"bugs": {
|
|
35
|
+
"url": "https://github.com/nodef/extra-cd/issues"
|
|
36
|
+
},
|
|
37
|
+
"homepage": "https://github.com/nodef/extra-cd#readme",
|
|
38
|
+
"devDependencies": {
|
|
39
|
+
"extra-build": "^2.0.31"
|
|
40
|
+
}
|
|
41
|
+
}
|
package/index.cmd
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
@echo off
|
|
2
|
-
setlocal enabledelayedexpansion
|
|
3
|
-
|
|
4
|
-
:: prepare
|
|
5
|
-
set d=%USERPROFILE%\.config\npm\extra-cd
|
|
6
|
-
if not exist %d% mkdir %d%
|
|
7
|
-
:: Get arg0
|
|
8
|
-
set a="%*"
|
|
9
|
-
if not "%a:~1,1%"=="=" set a="%1"
|
|
10
|
-
:: Remove quotes
|
|
11
|
-
set b=%a:~1,-1%
|
|
12
|
-
set i=%b:"=%
|
|
13
|
-
:: Get command and file name
|
|
14
|
-
set c=%i:~0,1%
|
|
15
|
-
set f=%d%\%i:~1%.ini
|
|
16
|
-
:: Get optional value
|
|
17
|
-
set v=%cd%
|
|
18
|
-
if not "%~2"=="" set v=%2
|
|
19
|
-
|
|
20
|
-
:: Options
|
|
21
|
-
if "%i%"=="--help" more %~dp0README.md & goto :eof
|
|
22
|
-
if "%i%"=="" goto :eof
|
|
23
|
-
if "%i%"=="-" endlocal & popd & goto :list
|
|
24
|
-
if "%i%"=="." endlocal & pushd . & goto :list
|
|
25
|
-
if "%c%"=="+" echo %v% > "%f%" & goto :eof
|
|
26
|
-
if "%c%"=="-" del "%f%" & goto :eof
|
|
27
|
-
if "%c%"=="=" for /f "delims=" %%a in ('type "%f%" 2^>NUL') do endlocal & pushd "%%~a" & goto :list
|
|
28
|
-
endlocal & pushd "%i%"
|
|
29
|
-
goto :list
|
|
30
|
-
|
|
31
|
-
:: List directory
|
|
32
|
-
:list
|
|
33
|
-
dir
|
|
34
|
-
echo.
|
|
35
|
-
|
|
36
|
-
:eof
|