vappman 0.8__py3-none-any.whl → 0.9.1__py3-none-any.whl

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.
vappman/main.py CHANGED
@@ -72,16 +72,28 @@ class Vappman:
72
72
  if not ok:
73
73
  sys.exit(1)
74
74
 
75
- def cmd_dict(self, cmd, start=''):
76
- """ Get lines with the given start."""
75
+ def cmd_dict(self, cmd, start=r'\s*◆\s'):
76
+ """ Get lines with the given start put into a dict keyed by the
77
+ 1st word.
78
+ """
77
79
  # Define the command to run
78
80
  command = cmd.split()
79
81
  # Run the command and capture the output
80
- result = subprocess.run(command, stdout=subprocess.PIPE, text=True, check=True)
82
+ try:
83
+ result = subprocess.run(command, stdout=subprocess.PIPE, text=True, check=False)
84
+ except Exception as exc:
85
+ Window.stop_curses()
86
+ print(f'FAILED: {command}: {exc}')
87
+ sys.exit(1)
88
+
89
+ if result.returncode != 0:
90
+ print(f'WARNING: {command}: {result.returncode=}')
81
91
  lines = result.stdout.splitlines()
92
+ ansi_escape_pattern = re.compile(r'\x1B\[[0-?]*[ -/]*[@-~]')
82
93
  rv = {}
83
94
  for line in lines:
84
- if line.startswith(start):
95
+ line = ansi_escape_pattern.sub('', line).strip() # get clean text
96
+ if re.match(start, line):
85
97
  wd1 = self.get_word1(line)
86
98
  if wd1:
87
99
  rv[wd1] = line
@@ -147,21 +159,21 @@ class Vappman:
147
159
  # EXPAND
148
160
  lines = [
149
161
  'ALWAYS AVAILABLE:',
150
- ' q or x - quit program (CTL-C disabled)',
151
162
  ' a - about (more info about app)',
152
163
  ' s - sync (update appman itself)',
153
164
  ' c - clean (remove unneeded files/folters)',
154
165
  ' U - update ALL installed apps',
155
- ' / - filter apps',
156
- ' ENTER = install, remove, or return from help',
166
+ ' q or x - quit program (CTL-C disabled)',
167
+ ' / - filter apps by keywords or regex',
157
168
  ' ESC = clear filter and jump to top',
169
+ ' ENTER = install, remove, or return from help',
158
170
  'CONTEXT SENSITIVE:',
159
171
  ' i - install uninstalled app',
160
172
  ' r - remove installed app',
161
- ' b - backup installed app',
162
173
  ' u - update installed app',
163
- ' t - test by opening a terminal emulator and launching the app'
174
+ ' b - backup installed app',
164
175
  ' o - overwrite app from its backup',
176
+ ' t - test by opening a terminal emulator and launching the app',
165
177
 
166
178
  ]
167
179
  for line in lines:
@@ -203,7 +215,7 @@ class Vappman:
203
215
  else:
204
216
  line += f' {key}:{verb}'
205
217
  # or EXPAND
206
- line += f' ?:help quit about sync clean Upd /{self.prev_filter} '
218
+ line += f' about sync clean Upd quit ?:help /{self.prev_filter} '
207
219
  # for action in self.actions:
208
220
  # line += f' {action[0]}:{action}'
209
221
  return line[1:]
@@ -219,9 +231,9 @@ class Vappman:
219
231
  # EXPAND
220
232
  if self.pick_is_installed:
221
233
  actions['r'] = 'rmv'
234
+ actions['u'] = 'upd'
222
235
  actions['b'] = 'bkup'
223
236
  actions['o'] = 'overwr'
224
- actions['u'] = 'upd'
225
237
  actions['t'] = 'test'
226
238
  else:
227
239
  actions['i'] = 'install'
@@ -241,6 +253,9 @@ class Vappman:
241
253
  wds = parts[0].split()
242
254
  this.win.head.pad.move(0, 0)
243
255
  for wd in wds:
256
+ if wd[0]in ('<', '|', '❚'):
257
+ this.win.add_header(wd + ' ', resume=True)
258
+ continue
244
259
  if wd:
245
260
  this.win.add_header(wd[0], attr=cs.A_BOLD|cs.A_UNDERLINE, resume=True)
246
261
  if wd[1:]:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: vappman
3
- Version: 0.8
3
+ Version: 0.9.1
4
4
  Summary: A visual wrapper for appman
5
5
  Author-email: Joe Defen <joedef@google.com>
6
6
  License: MIT
@@ -13,8 +13,8 @@ Classifier: Operating System :: POSIX :: Linux
13
13
  Requires-Python: >=3.8
14
14
  Description-Content-Type: text/markdown
15
15
  License-File: LICENSE
16
- Requires-Dist: psutil >=5.9
17
- Requires-Dist: importlib-metadata ; python_version < "3.8"
16
+ Requires-Dist: psutil>=5.9
17
+ Requires-Dist: importlib-metadata; python_version < "3.8"
18
18
 
19
19
  # vappman
20
20
  `vappman` presents a visual (curses) interface to `appman`.
@@ -69,12 +69,13 @@ But it does NOT cover:
69
69
  * Use `i` to install apps, and `r` to remove apps. When you install or remove an app, `appman` drops out of `curses` mode, runs the `appman` command so you can see the result, and then prompts your to hit ENTER to return to `vappman.
70
70
  * Use `t` to "test" an installed app. This launches a terminal emulator and then the app so you can see issues. This is not for daily use obviously, but for after install or when having unknown issues and you wish to start the investigation.
71
71
 
72
- ## Example Screenshot (of v0.7 ... current release will vary slightly)
72
+ ## Example Screenshot (of v0.9 ... current release will vary slightly)
73
73
  ![vappman-with-filter](https://github.com/joedefen/vappman/blob/main/images/vappman-with-filter.png?raw=true).
74
74
 
75
75
  ---
76
76
 
77
77
  NOTES: in this example:
78
+ * keys to the left of `❚` apply to the highlighted app; keys to the right apply globally.
78
79
  * the filter is `card` so it shows app lines with words starting with `card`.
79
80
  * the reverse video, current position is on `glabels`;
80
81
  thus if `i` (or ENTER) is typed, `appman install glabels` is run.
@@ -82,8 +83,8 @@ NOTES: in this example:
82
83
  all the filtered apps; otherwise, the decoration suggests where you are in the
83
84
  partial view of the filtered apps.
84
85
  * the matching installed app has the '✔✔✔' prefix.
85
- * the fixed top line shows some of the available action keys (e.g., `q` quits the app)
86
+ * the fixed top line shows mos of the available action keys (e.g., `q` quits the app)
86
87
  * use `?` to open the help screen describing all keys (including navigation)
87
88
 
88
- ## Screen Recording (Intro to vappman based on v0.7)
89
- [![Screen Recording](https://i9.ytimg.com/vi_webp/NUHYN9_DZtA/mq3.webp?sqp=CMTu4LMG-oaymwEmCMACELQB8quKqQMa8AEB-AHqBYAC4AOKAgwIABABGEogZShRMA8=&rs=AOn4CLBaBrOpAhJkRIQQNNdCzYaqpOYl-Q)](https://youtu.be/NUHYN9_DZtA)
89
+ ## Screen Recording (Intro to vappman based on v0.9)
90
+ [![Screen Recording](https://i9.ytimg.com/vi_webp/NUHYN9_DZtA/mq3.webp?sqp=CMTu4LMG-oaymwEmCMACELQB8quKqQMa8AEB-AHqBYAC4AOKAgwIABABGEogZShRMA8=&rs=AOn4CLBaBrOpAhJkRIQQNNdCzYaqpOYl-Q)](https://www.youtube.com/watch?v=fC2EYMMcMQk)
@@ -0,0 +1,9 @@
1
+ vappman/PowerWindow.py,sha256=pQGXsAMeuiHn-vtEiVG0rgW1eCslh3ukC-VrPhH_j3k,28587
2
+ vappman/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
+ vappman/main.py,sha256=f1Hnx5SF0pXvKtERtdXoKW_R4UDxLUuq25MZoHJnc8g,17682
4
+ vappman-0.9.1.dist-info/LICENSE,sha256=qB9OdnyyF6WYHiEIXVm0rOSdcf8e2ctorrtWs6CC5lU,1062
5
+ vappman-0.9.1.dist-info/METADATA,sha256=JhPKqVdh-XtOum4iwLL7R-lKyrFgAU7xsbcG6yimI7M,5027
6
+ vappman-0.9.1.dist-info/WHEEL,sha256=UvcQYKBHoFqaQd6LKyqHw9fxEolWLQnlzP0h_LgJAfI,91
7
+ vappman-0.9.1.dist-info/entry_points.txt,sha256=7_1MiUvkCJoElLePOCJYqhkQN4xmadBRQCKupOwzt90,46
8
+ vappman-0.9.1.dist-info/top_level.txt,sha256=5_Gb5oZh7s2-i62gLXZ6INVALAV9D0-yqh0TvNqpPC4,8
9
+ vappman-0.9.1.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (70.1.1)
2
+ Generator: setuptools (74.0.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,9 +0,0 @@
1
- vappman/PowerWindow.py,sha256=pQGXsAMeuiHn-vtEiVG0rgW1eCslh3ukC-VrPhH_j3k,28587
2
- vappman/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
- vappman/main.py,sha256=FBTCzbOa9dCyzTHX3ietF9_avrMRareYFxmnd65wc2M,17066
4
- vappman-0.8.dist-info/LICENSE,sha256=qB9OdnyyF6WYHiEIXVm0rOSdcf8e2ctorrtWs6CC5lU,1062
5
- vappman-0.8.dist-info/METADATA,sha256=BJMibKDn0HtJFZcvP55MtNLnqK1P77NeTFOHkaDTm7o,4921
6
- vappman-0.8.dist-info/WHEEL,sha256=mguMlWGMX-VHnMpKOjjQidIo1ssRlCFu4a4mBpz1s2M,91
7
- vappman-0.8.dist-info/entry_points.txt,sha256=7_1MiUvkCJoElLePOCJYqhkQN4xmadBRQCKupOwzt90,46
8
- vappman-0.8.dist-info/top_level.txt,sha256=5_Gb5oZh7s2-i62gLXZ6INVALAV9D0-yqh0TvNqpPC4,8
9
- vappman-0.8.dist-info/RECORD,,