twd-m4sc0 1.2.1__tar.gz → 1.3.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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: twd_m4sc0
3
- Version: 1.2.1
3
+ Version: 1.3.0
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
@@ -66,6 +66,12 @@ twd -g
66
66
  twd -l
67
67
  ```
68
68
 
69
+ - Unset the TWD and delete the file
70
+
71
+ ```bash
72
+ twd -u
73
+ ```
74
+
69
75
  ### Optional Parameters
70
76
 
71
77
  #### Simple Output
@@ -53,6 +53,12 @@ twd -g
53
53
  twd -l
54
54
  ```
55
55
 
56
+ - Unset the TWD and delete the file
57
+
58
+ ```bash
59
+ twd -u
60
+ ```
61
+
56
62
  ### Optional Parameters
57
63
 
58
64
  #### Simple Output
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name="twd_m4sc0",
5
- version="1.2.1",
5
+ version="1.3.0",
6
6
  packages=find_packages(),
7
7
  entry_points={
8
8
  "console_scripts": [
@@ -64,6 +64,13 @@ def show_directory(output=True, simple_output=False):
64
64
  else:
65
65
  output_handler(f"Current TWD: {TWD}", TWD, output, simple_output)
66
66
 
67
+ def unset_directory(output=True, simple_output=False):
68
+ if not os.path.exists(TWD_FILE):
69
+ output_handler(f"No TWD file found", None, output, simple_output)
70
+ else:
71
+ os.remove(TWD_FILE)
72
+ output_handler(f"TWD File deleted and TWD unset", None, output, simple_output)
73
+
67
74
  def get_package_version():
68
75
  try:
69
76
  return version("twd_m4sc0")
@@ -76,6 +83,7 @@ def main():
76
83
  parser.add_argument('-s', '--save', nargs='?', const='', help="Save the current or specified directory")
77
84
  parser.add_argument('-g', '--go', action='store_true', help="Go to the saved directory")
78
85
  parser.add_argument('-l', '--list', action='store_true', help="Show saved TWD")
86
+ parser.add_argument('-u', '--unset', action='store_true', help="Unset the saved TWD")
79
87
  parser.add_argument('-v', '--version', action='version', version=f'TWD Version: {get_package_version()}', help='Show the current version of TWD installed')
80
88
  parser.add_argument('--shell', action='store_true', help="Output shell function for integration")
81
89
  parser.add_argument('--simple-output', action='store_true', help="Only print essential output (new directory, absolute path, etc.)")
@@ -89,11 +97,11 @@ def main():
89
97
  if args.shell:
90
98
  print('''
91
99
  function twd() {
92
- output=$(python3 -m twd "$@")
100
+ output=$(python3 -m twd "$@");
93
101
  if [[ "$1" == "-g" ]]; then
94
- eval "$output"
102
+ eval "$output";
95
103
  else
96
- echo "$output"
104
+ echo "$output";
97
105
  fi
98
106
  }
99
107
  ''')
@@ -105,6 +113,8 @@ def main():
105
113
  return go_to_directory(output, simple_output)
106
114
  elif args.list:
107
115
  show_directory(output, simple_output)
116
+ elif args.unset:
117
+ unset_directory(output, simple_output)
108
118
  else:
109
119
  parser.print_help()
110
120
  return 1
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: twd_m4sc0
3
- Version: 1.2.1
3
+ Version: 1.3.0
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
@@ -66,6 +66,12 @@ twd -g
66
66
  twd -l
67
67
  ```
68
68
 
69
+ - Unset the TWD and delete the file
70
+
71
+ ```bash
72
+ twd -u
73
+ ```
74
+
69
75
  ### Optional Parameters
70
76
 
71
77
  #### Simple Output
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes