twd-m4sc0 1.1.0__tar.gz → 1.2.0__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.
@@ -0,0 +1,103 @@
1
+ Metadata-Version: 2.1
2
+ Name: twd_m4sc0
3
+ Version: 1.2.0
4
+ Summary: A tool to temporarily save and go to a working directory
5
+ Home-page: https://github.com/m4sc0/twd
6
+ Author: m4sc0
7
+ Classifier: Programming Language :: Python :: 3
8
+ Classifier: License :: OSI Approved :: MIT License
9
+ Classifier: Operating System :: OS Independent
10
+ Requires-Python: >=3.6
11
+ Description-Content-Type: text/markdown
12
+ License-File: LICENSE
13
+
14
+ # twd-m4sc0
15
+
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 all users who frequently need to switch between directories in the terminal.
17
+
18
+ ## Features
19
+
20
+ - Save the current working directory.
21
+ - Go back to the saved directory.
22
+ - List the saved directory.
23
+ - Integrates with your shell for seamless directory management.
24
+
25
+ ## Installation
26
+
27
+ ### Installation using `pip`:
28
+
29
+ 1. Install the package from the `pypi` repository:
30
+
31
+ ```bash
32
+ pip install twd-m4sc0
33
+ ```
34
+
35
+ 2. Add the following line to your `.bashrc` or `.zshrc` to set up the shell function:
36
+
37
+ ```bash
38
+ eval $(twd --shell)
39
+ ```
40
+
41
+ 3. Exit and reopen the terminal or reload using:
42
+
43
+ ```bash
44
+ source ~/.bashrc
45
+ # or
46
+ source ~/.zshrc
47
+ ```
48
+
49
+ ## Usage
50
+
51
+ - Save a directory
52
+
53
+ ```bash
54
+ twd -s [path]
55
+ ```
56
+
57
+ - Go to the saved directory
58
+
59
+ ```bash
60
+ twd -g
61
+ ```
62
+
63
+ - List the saved directory
64
+
65
+ ```bash
66
+ twd -l
67
+
68
+ ### Optional Parameters
69
+
70
+ #### Simple Output
71
+
72
+ Simpler output is meant to be for script usage
73
+
74
+ - Example with simple-output
75
+
76
+ ```bash
77
+ user:~/.config $ twd -s --simple-output
78
+ /home/user/.config
79
+ ```
80
+
81
+ - Example without simple-output
82
+
83
+ ```bash
84
+ user:~/.config $ twd -s
85
+ Saved TWD to /home/user/.config
86
+ ```
87
+
88
+ # Contribution
89
+
90
+ To set up a dev environment:
91
+
92
+ 1. Clone the repo:
93
+
94
+ ```bash
95
+ git clone https://github.com/m4sc0/twd
96
+ cd twd
97
+ ```
98
+
99
+ 2. Install the package in editable mode using `pip`:
100
+
101
+ ```bash
102
+ pip install -e .
103
+ ```
@@ -0,0 +1,90 @@
1
+ # twd-m4sc0
2
+
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 all users who frequently need to switch between directories in the terminal.
4
+
5
+ ## Features
6
+
7
+ - Save the current working directory.
8
+ - Go back to the saved directory.
9
+ - List the saved directory.
10
+ - Integrates with your shell for seamless directory management.
11
+
12
+ ## Installation
13
+
14
+ ### Installation using `pip`:
15
+
16
+ 1. Install the package from the `pypi` repository:
17
+
18
+ ```bash
19
+ pip install twd-m4sc0
20
+ ```
21
+
22
+ 2. Add the following line to your `.bashrc` or `.zshrc` to set up the shell function:
23
+
24
+ ```bash
25
+ eval $(twd --shell)
26
+ ```
27
+
28
+ 3. Exit and reopen the terminal or reload using:
29
+
30
+ ```bash
31
+ source ~/.bashrc
32
+ # or
33
+ source ~/.zshrc
34
+ ```
35
+
36
+ ## Usage
37
+
38
+ - Save a directory
39
+
40
+ ```bash
41
+ twd -s [path]
42
+ ```
43
+
44
+ - Go to the saved directory
45
+
46
+ ```bash
47
+ twd -g
48
+ ```
49
+
50
+ - List the saved directory
51
+
52
+ ```bash
53
+ twd -l
54
+
55
+ ### Optional Parameters
56
+
57
+ #### Simple Output
58
+
59
+ Simpler output is meant to be for script usage
60
+
61
+ - Example with simple-output
62
+
63
+ ```bash
64
+ user:~/.config $ twd -s --simple-output
65
+ /home/user/.config
66
+ ```
67
+
68
+ - Example without simple-output
69
+
70
+ ```bash
71
+ user:~/.config $ twd -s
72
+ Saved TWD to /home/user/.config
73
+ ```
74
+
75
+ # Contribution
76
+
77
+ To set up a dev environment:
78
+
79
+ 1. Clone the repo:
80
+
81
+ ```bash
82
+ git clone https://github.com/m4sc0/twd
83
+ cd twd
84
+ ```
85
+
86
+ 2. Install the package in editable mode using `pip`:
87
+
88
+ ```bash
89
+ pip install -e .
90
+ ```
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name="twd_m4sc0",
5
- version="1.1.0",
5
+ version="1.2.0",
6
6
  packages=find_packages(),
7
7
  entry_points={
8
8
  "console_scripts": [
@@ -8,7 +8,7 @@ TWD_FILE = os.path.join(os.path.expanduser("~"), ".twd")
8
8
  def get_absolute_path(path):
9
9
  return os.path.abspath(path)
10
10
 
11
- def save_directory(path=None):
11
+ def save_directory(path=None, output=None, simple_output=False):
12
12
  if path is None:
13
13
  path = os.getcwd()
14
14
  else:
@@ -17,7 +17,10 @@ def save_directory(path=None):
17
17
  with open(TWD_FILE, "w") as f:
18
18
  f.write(path)
19
19
 
20
- print(f"Saved TWD to {path}")
20
+ if output and not simple_output:
21
+ print(f"Saved TWD to {path}")
22
+ elif output and simple_output:
23
+ print(path)
21
24
 
22
25
  def load_directory():
23
26
  if not os.path.exists(TWD_FILE):
@@ -26,27 +29,36 @@ def load_directory():
26
29
  with open(TWD_FILE, "r") as f:
27
30
  return f.read().strip()
28
31
 
29
- def go_to_directory():
32
+ def go_to_directory(output, simple_output=False):
30
33
  TWD = load_directory()
31
34
 
32
35
  if TWD is None:
33
- print("No TWD found")
36
+ if output and not simple_output:
37
+ print("No TWD found")
34
38
  return 1
35
39
  else:
36
40
  if os.path.exists(TWD):
37
- print(f"cd {TWD}")
41
+ if output and simple_output:
42
+ print(TWD)
43
+ elif output and not simple_output:
44
+ print(f"cd {TWD}")
38
45
  return 0
39
46
  else:
40
- print(f"Directory does not exist: {TWD}")
47
+ if output and not simple_output:
48
+ print(f"Directory does not exist: {TWD}")
41
49
  return 1
42
50
 
43
- def show_directory():
51
+ def show_directory(output, simple_output=False):
44
52
  TWD = load_directory()
45
53
 
46
54
  if TWD is None:
47
- print("No TWD set")
55
+ if output and not simple_output:
56
+ print("No TWD set")
48
57
  else:
49
- print(f"Current TWD: {TWD}")
58
+ if output and simple_output:
59
+ print(TWD)
60
+ elif output and not simple_output:
61
+ print(f"Current TWD: {TWD}")
50
62
 
51
63
  def get_package_version():
52
64
  try:
@@ -62,28 +74,31 @@ def main():
62
74
  parser.add_argument('-l', '--list', action='store_true', help="Show saved TWD")
63
75
  parser.add_argument('--shell', action='store_true', help="Output shell function for integration")
64
76
  parser.add_argument('-v', '--version', action='version', version=f'TWD Version: {get_package_version()}', help='Show the current version of TWD installed')
77
+ parser.add_argument('--simple-output', action='store_true', help="Only print essential output (new directory, absolute path, etc.)")
78
+ parser.add_argument('--no-output', action='store_true', help="Prevents the console from sending output")
65
79
 
66
80
  args = parser.parse_args()
67
81
 
82
+ output = not args.no_output
83
+ simple_output = args.simple_output
84
+
68
85
  if args.shell:
69
- print('''
70
- function twd() {
86
+ print('''function twd() {
71
87
  output=$(python3 -m twd "$@")
72
88
  if [[ "$1" == "-g" ]]; then
73
89
  eval "$output"
74
90
  else {
75
91
  echo "$output"
76
92
  fi
77
- }
78
- ''')
93
+ }''')
79
94
  return 0
80
95
 
81
96
  if args.save is not None:
82
- save_directory(args.save if args.save else None)
97
+ save_directory(args.save if args.save else None, output, simple_output)
83
98
  elif args.go:
84
- return go_to_directory()
99
+ return go_to_directory(output, simple_output)
85
100
  elif args.list:
86
- show_directory()
101
+ show_directory(output, simple_output)
87
102
  else:
88
103
  parser.print_help()
89
104
  return 1
@@ -0,0 +1,103 @@
1
+ Metadata-Version: 2.1
2
+ Name: twd_m4sc0
3
+ Version: 1.2.0
4
+ Summary: A tool to temporarily save and go to a working directory
5
+ Home-page: https://github.com/m4sc0/twd
6
+ Author: m4sc0
7
+ Classifier: Programming Language :: Python :: 3
8
+ Classifier: License :: OSI Approved :: MIT License
9
+ Classifier: Operating System :: OS Independent
10
+ Requires-Python: >=3.6
11
+ Description-Content-Type: text/markdown
12
+ License-File: LICENSE
13
+
14
+ # twd-m4sc0
15
+
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 all users who frequently need to switch between directories in the terminal.
17
+
18
+ ## Features
19
+
20
+ - Save the current working directory.
21
+ - Go back to the saved directory.
22
+ - List the saved directory.
23
+ - Integrates with your shell for seamless directory management.
24
+
25
+ ## Installation
26
+
27
+ ### Installation using `pip`:
28
+
29
+ 1. Install the package from the `pypi` repository:
30
+
31
+ ```bash
32
+ pip install twd-m4sc0
33
+ ```
34
+
35
+ 2. Add the following line to your `.bashrc` or `.zshrc` to set up the shell function:
36
+
37
+ ```bash
38
+ eval $(twd --shell)
39
+ ```
40
+
41
+ 3. Exit and reopen the terminal or reload using:
42
+
43
+ ```bash
44
+ source ~/.bashrc
45
+ # or
46
+ source ~/.zshrc
47
+ ```
48
+
49
+ ## Usage
50
+
51
+ - Save a directory
52
+
53
+ ```bash
54
+ twd -s [path]
55
+ ```
56
+
57
+ - Go to the saved directory
58
+
59
+ ```bash
60
+ twd -g
61
+ ```
62
+
63
+ - List the saved directory
64
+
65
+ ```bash
66
+ twd -l
67
+
68
+ ### Optional Parameters
69
+
70
+ #### Simple Output
71
+
72
+ Simpler output is meant to be for script usage
73
+
74
+ - Example with simple-output
75
+
76
+ ```bash
77
+ user:~/.config $ twd -s --simple-output
78
+ /home/user/.config
79
+ ```
80
+
81
+ - Example without simple-output
82
+
83
+ ```bash
84
+ user:~/.config $ twd -s
85
+ Saved TWD to /home/user/.config
86
+ ```
87
+
88
+ # Contribution
89
+
90
+ To set up a dev environment:
91
+
92
+ 1. Clone the repo:
93
+
94
+ ```bash
95
+ git clone https://github.com/m4sc0/twd
96
+ cd twd
97
+ ```
98
+
99
+ 2. Install the package in editable mode using `pip`:
100
+
101
+ ```bash
102
+ pip install -e .
103
+ ```
twd_m4sc0-1.1.0/PKG-INFO DELETED
@@ -1,12 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: twd_m4sc0
3
- Version: 1.1.0
4
- Summary: A tool to temporarily save and go to a working directory
5
- Home-page: https://github.com/m4sc0/twd
6
- Author: m4sc0
7
- Classifier: Programming Language :: Python :: 3
8
- Classifier: License :: OSI Approved :: MIT License
9
- Classifier: Operating System :: OS Independent
10
- Requires-Python: >=3.6
11
- Description-Content-Type: text/markdown
12
- License-File: LICENSE
twd_m4sc0-1.1.0/README.md DELETED
File without changes
@@ -1,12 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: twd_m4sc0
3
- Version: 1.1.0
4
- Summary: A tool to temporarily save and go to a working directory
5
- Home-page: https://github.com/m4sc0/twd
6
- Author: m4sc0
7
- Classifier: Programming Language :: Python :: 3
8
- Classifier: License :: OSI Approved :: MIT License
9
- Classifier: Operating System :: OS Independent
10
- Requires-Python: >=3.6
11
- Description-Content-Type: text/markdown
12
- License-File: LICENSE
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes