twd-m4sc0 2.0.1__tar.gz → 2.0.3__tar.gz
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.
- {twd_m4sc0-2.0.1 → twd_m4sc0-2.0.3}/PKG-INFO +29 -8
- {twd_m4sc0-2.0.1 → twd_m4sc0-2.0.3}/README.md +28 -7
- {twd_m4sc0-2.0.1 → twd_m4sc0-2.0.3}/setup.py +1 -1
- {twd_m4sc0-2.0.1 → twd_m4sc0-2.0.3}/twd/twd.py +30 -1
- {twd_m4sc0-2.0.1 → twd_m4sc0-2.0.3}/twd_m4sc0.egg-info/PKG-INFO +29 -8
- {twd_m4sc0-2.0.1 → twd_m4sc0-2.0.3}/LICENSE +0 -0
- {twd_m4sc0-2.0.1 → twd_m4sc0-2.0.3}/setup.cfg +0 -0
- {twd_m4sc0-2.0.1 → twd_m4sc0-2.0.3}/tests/__init__.py +0 -0
- {twd_m4sc0-2.0.1 → twd_m4sc0-2.0.3}/tests/test_twd.py +0 -0
- {twd_m4sc0-2.0.1 → twd_m4sc0-2.0.3}/twd/__init__.py +0 -0
- {twd_m4sc0-2.0.1 → twd_m4sc0-2.0.3}/twd/__main__.py +0 -0
- {twd_m4sc0-2.0.1 → twd_m4sc0-2.0.3}/twd/crud.py +0 -0
- {twd_m4sc0-2.0.1 → twd_m4sc0-2.0.3}/twd/logger.py +0 -0
- {twd_m4sc0-2.0.1 → twd_m4sc0-2.0.3}/twd/screen.py +0 -0
- {twd_m4sc0-2.0.1 → twd_m4sc0-2.0.3}/twd_m4sc0.egg-info/SOURCES.txt +0 -0
- {twd_m4sc0-2.0.1 → twd_m4sc0-2.0.3}/twd_m4sc0.egg-info/dependency_links.txt +0 -0
- {twd_m4sc0-2.0.1 → twd_m4sc0-2.0.3}/twd_m4sc0.egg-info/entry_points.txt +0 -0
- {twd_m4sc0-2.0.1 → twd_m4sc0-2.0.3}/twd_m4sc0.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: twd_m4sc0
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.3
|
|
4
4
|
Summary: A tool to temporarily save and go to a working directory
|
|
5
5
|
Home-page: https://github.com/m4sc0/twd
|
|
6
6
|
Author: m4sc0
|
|
@@ -11,12 +11,11 @@ Requires-Python: >=3.6
|
|
|
11
11
|
Description-Content-Type: text/markdown
|
|
12
12
|
License-File: LICENSE
|
|
13
13
|
|
|
14
|
-
|
|
15
14
|
# twd-m4sc0
|
|
16
15
|
|
|
17
16
|
`twd-m4sc0` is a command-line tool that allows you to temporarily save a working directory and easily navigate back to it. It's designed for developers and users who frequently need to switch between directories in the terminal.
|
|
18
17
|
|
|
19
|
-
> All Versions `< v1.5` are considered deprecated and should not be used anymore because of the `config` file that was introduced in that version. This file is incompatible with newer versions and might cause issues or break the program.
|
|
18
|
+
> All Versions `< v1.5` are considered deprecated and should not be used anymore because of the `config` file that was introduced in that version. This file is incompatible with newer versions and might cause issues or break the program.
|
|
20
19
|
|
|
21
20
|
## Features
|
|
22
21
|
|
|
@@ -29,7 +28,7 @@ License-File: LICENSE
|
|
|
29
28
|
|
|
30
29
|
## Installation
|
|
31
30
|
|
|
32
|
-
### Installation using `pip
|
|
31
|
+
### Installation using `pip`
|
|
33
32
|
|
|
34
33
|
1. Install the package from the `pypi` repository:
|
|
35
34
|
|
|
@@ -37,19 +36,41 @@ License-File: LICENSE
|
|
|
37
36
|
pip install twd-m4sc0
|
|
38
37
|
```
|
|
39
38
|
|
|
40
|
-
2.
|
|
39
|
+
2. Ensure proper installation by checking the version
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
python3 -m twd -v
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Setup using in-built commands
|
|
46
|
+
|
|
47
|
+
> This setup information is only recommend if you're system is using the `.bashrc` file provided by debian based systems and it's located at `~/.bashrc`. If you're unsure what you're shell configuration file is called or where it's located please refer to your official OS documentation to ensure proper functionality.
|
|
48
|
+
|
|
49
|
+
1. Run the following command to activate the `twd` shell function
|
|
50
|
+
|
|
51
|
+
> Replace `[alias]` with an alias of your choice to customize the way you're calling the script and follow the given instructions
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
python3 -m twd --setup [alias]
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Manual setup
|
|
41
58
|
|
|
42
|
-
|
|
59
|
+
1. Add the following line to your shell configuration file:
|
|
43
60
|
|
|
44
61
|
```bash
|
|
45
62
|
eval $(python3 -m twd --shell [alias])
|
|
46
63
|
```
|
|
47
64
|
|
|
48
|
-
|
|
65
|
+
2. Run the following command to apply the new configuration:
|
|
49
66
|
|
|
50
67
|
```bash
|
|
51
68
|
source ~/.bashrc
|
|
52
|
-
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
or
|
|
72
|
+
|
|
73
|
+
```bash
|
|
53
74
|
source ~/.zshrc
|
|
54
75
|
```
|
|
55
76
|
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
|
|
2
1
|
# twd-m4sc0
|
|
3
2
|
|
|
4
3
|
`twd-m4sc0` is a command-line tool that allows you to temporarily save a working directory and easily navigate back to it. It's designed for developers and users who frequently need to switch between directories in the terminal.
|
|
5
4
|
|
|
6
|
-
> All Versions `< v1.5` are considered deprecated and should not be used anymore because of the `config` file that was introduced in that version. This file is incompatible with newer versions and might cause issues or break the program.
|
|
5
|
+
> All Versions `< v1.5` are considered deprecated and should not be used anymore because of the `config` file that was introduced in that version. This file is incompatible with newer versions and might cause issues or break the program.
|
|
7
6
|
|
|
8
7
|
## Features
|
|
9
8
|
|
|
@@ -16,7 +15,7 @@
|
|
|
16
15
|
|
|
17
16
|
## Installation
|
|
18
17
|
|
|
19
|
-
### Installation using `pip
|
|
18
|
+
### Installation using `pip`
|
|
20
19
|
|
|
21
20
|
1. Install the package from the `pypi` repository:
|
|
22
21
|
|
|
@@ -24,19 +23,41 @@
|
|
|
24
23
|
pip install twd-m4sc0
|
|
25
24
|
```
|
|
26
25
|
|
|
27
|
-
2.
|
|
26
|
+
2. Ensure proper installation by checking the version
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
python3 -m twd -v
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Setup using in-built commands
|
|
33
|
+
|
|
34
|
+
> This setup information is only recommend if you're system is using the `.bashrc` file provided by debian based systems and it's located at `~/.bashrc`. If you're unsure what you're shell configuration file is called or where it's located please refer to your official OS documentation to ensure proper functionality.
|
|
35
|
+
|
|
36
|
+
1. Run the following command to activate the `twd` shell function
|
|
37
|
+
|
|
38
|
+
> Replace `[alias]` with an alias of your choice to customize the way you're calling the script and follow the given instructions
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
python3 -m twd --setup [alias]
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Manual setup
|
|
28
45
|
|
|
29
|
-
|
|
46
|
+
1. Add the following line to your shell configuration file:
|
|
30
47
|
|
|
31
48
|
```bash
|
|
32
49
|
eval $(python3 -m twd --shell [alias])
|
|
33
50
|
```
|
|
34
51
|
|
|
35
|
-
|
|
52
|
+
2. Run the following command to apply the new configuration:
|
|
36
53
|
|
|
37
54
|
```bash
|
|
38
55
|
source ~/.bashrc
|
|
39
|
-
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
or
|
|
59
|
+
|
|
60
|
+
```bash
|
|
40
61
|
source ~/.zshrc
|
|
41
62
|
```
|
|
42
63
|
|
|
@@ -18,6 +18,7 @@ CONFIG_FILE = os.path.join(TWD_DIR, "config")
|
|
|
18
18
|
DEFAULT_CONFIG = {
|
|
19
19
|
"data_file": os.path.expanduser("~/.twd/data"),
|
|
20
20
|
"output_behaviour": 2,
|
|
21
|
+
"clear_after_screen": False,
|
|
21
22
|
"log_file": os.path.expanduser("~/.twd/log"),
|
|
22
23
|
"error_file": os.path.expanduser("~/.twd/error"),
|
|
23
24
|
"log_format": "%(asctime)s - %(levelname)s - %(message)s",
|
|
@@ -92,18 +93,24 @@ def validate_alias(alias):
|
|
|
92
93
|
def output_handler(
|
|
93
94
|
message=None, path=None, output=True, simple_output=False, message_type=0
|
|
94
95
|
):
|
|
95
|
-
log.info(
|
|
96
|
+
log.info(message or path)
|
|
96
97
|
|
|
97
98
|
if CONFIG["output_behaviour"] == 1 or simple_output:
|
|
98
99
|
if path:
|
|
99
100
|
with open("/tmp/twd_path", "w") as f:
|
|
100
101
|
f.write(path)
|
|
102
|
+
if CONFIG["clear_after_screen"]:
|
|
103
|
+
with open("/tmp/twd_clear", "w") as f:
|
|
104
|
+
f.write(path)
|
|
101
105
|
if output:
|
|
102
106
|
print(path)
|
|
103
107
|
elif CONFIG["output_behaviour"] == 2:
|
|
104
108
|
if path:
|
|
105
109
|
with open("/tmp/twd_path", "w") as f:
|
|
106
110
|
f.write(path)
|
|
111
|
+
if CONFIG["clear_after_screen"]:
|
|
112
|
+
with open("/tmp/twd_clear", "w") as f:
|
|
113
|
+
f.write(path)
|
|
107
114
|
if output:
|
|
108
115
|
print(message)
|
|
109
116
|
|
|
@@ -248,6 +255,16 @@ This feature is to prevent accidental execution.""",
|
|
|
248
255
|
output_handler("TWD File deleted and TWD unset", None, output, simple_output)
|
|
249
256
|
|
|
250
257
|
|
|
258
|
+
def setup(alias):
|
|
259
|
+
bashrc_path = os.path.expanduser("~/.bashrc")
|
|
260
|
+
alias = "twd" if not alias else alias
|
|
261
|
+
with open(bashrc_path, "a") as file:
|
|
262
|
+
file.write(f"\neval $(python3 -m twd --shell {alias})\n")
|
|
263
|
+
print("Please execute the following command to activate TWD:")
|
|
264
|
+
print("")
|
|
265
|
+
print(f"source {bashrc_path}")
|
|
266
|
+
|
|
267
|
+
|
|
251
268
|
def get_package_version():
|
|
252
269
|
try:
|
|
253
270
|
return version("twd_m4sc0")
|
|
@@ -261,6 +278,10 @@ def main():
|
|
|
261
278
|
description="Temporarily save and navigate to working directories."
|
|
262
279
|
)
|
|
263
280
|
|
|
281
|
+
parser.add_argument(
|
|
282
|
+
"--setup", nargs="?", const="twd", help="Automatic setup in the .bashrc file"
|
|
283
|
+
)
|
|
284
|
+
|
|
264
285
|
parser.add_argument("directory", nargs="?", help="Directory to save")
|
|
265
286
|
parser.add_argument(
|
|
266
287
|
"alias", nargs="?", help="Alias for the saved directory (optional)"
|
|
@@ -310,9 +331,17 @@ def main():
|
|
|
310
331
|
cd "$(cat /tmp/twd_path)";
|
|
311
332
|
/bin/rm -f /tmp/twd_path;
|
|
312
333
|
fi;
|
|
334
|
+
if [ -f /tmp/twd_clear ]; then
|
|
335
|
+
clear;
|
|
336
|
+
/bin/rm -f /tmp/twd_clear;
|
|
337
|
+
fi;
|
|
313
338
|
}}""")
|
|
314
339
|
return 0
|
|
315
340
|
|
|
341
|
+
if args.setup:
|
|
342
|
+
setup(args.setup)
|
|
343
|
+
return 0
|
|
344
|
+
|
|
316
345
|
directory = args.directory or args.dir
|
|
317
346
|
alias = args.alias or args.ali
|
|
318
347
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: twd_m4sc0
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.3
|
|
4
4
|
Summary: A tool to temporarily save and go to a working directory
|
|
5
5
|
Home-page: https://github.com/m4sc0/twd
|
|
6
6
|
Author: m4sc0
|
|
@@ -11,12 +11,11 @@ Requires-Python: >=3.6
|
|
|
11
11
|
Description-Content-Type: text/markdown
|
|
12
12
|
License-File: LICENSE
|
|
13
13
|
|
|
14
|
-
|
|
15
14
|
# twd-m4sc0
|
|
16
15
|
|
|
17
16
|
`twd-m4sc0` is a command-line tool that allows you to temporarily save a working directory and easily navigate back to it. It's designed for developers and users who frequently need to switch between directories in the terminal.
|
|
18
17
|
|
|
19
|
-
> All Versions `< v1.5` are considered deprecated and should not be used anymore because of the `config` file that was introduced in that version. This file is incompatible with newer versions and might cause issues or break the program.
|
|
18
|
+
> All Versions `< v1.5` are considered deprecated and should not be used anymore because of the `config` file that was introduced in that version. This file is incompatible with newer versions and might cause issues or break the program.
|
|
20
19
|
|
|
21
20
|
## Features
|
|
22
21
|
|
|
@@ -29,7 +28,7 @@ License-File: LICENSE
|
|
|
29
28
|
|
|
30
29
|
## Installation
|
|
31
30
|
|
|
32
|
-
### Installation using `pip
|
|
31
|
+
### Installation using `pip`
|
|
33
32
|
|
|
34
33
|
1. Install the package from the `pypi` repository:
|
|
35
34
|
|
|
@@ -37,19 +36,41 @@ License-File: LICENSE
|
|
|
37
36
|
pip install twd-m4sc0
|
|
38
37
|
```
|
|
39
38
|
|
|
40
|
-
2.
|
|
39
|
+
2. Ensure proper installation by checking the version
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
python3 -m twd -v
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Setup using in-built commands
|
|
46
|
+
|
|
47
|
+
> This setup information is only recommend if you're system is using the `.bashrc` file provided by debian based systems and it's located at `~/.bashrc`. If you're unsure what you're shell configuration file is called or where it's located please refer to your official OS documentation to ensure proper functionality.
|
|
48
|
+
|
|
49
|
+
1. Run the following command to activate the `twd` shell function
|
|
50
|
+
|
|
51
|
+
> Replace `[alias]` with an alias of your choice to customize the way you're calling the script and follow the given instructions
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
python3 -m twd --setup [alias]
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Manual setup
|
|
41
58
|
|
|
42
|
-
|
|
59
|
+
1. Add the following line to your shell configuration file:
|
|
43
60
|
|
|
44
61
|
```bash
|
|
45
62
|
eval $(python3 -m twd --shell [alias])
|
|
46
63
|
```
|
|
47
64
|
|
|
48
|
-
|
|
65
|
+
2. Run the following command to apply the new configuration:
|
|
49
66
|
|
|
50
67
|
```bash
|
|
51
68
|
source ~/.bashrc
|
|
52
|
-
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
or
|
|
72
|
+
|
|
73
|
+
```bash
|
|
53
74
|
source ~/.zshrc
|
|
54
75
|
```
|
|
55
76
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|