vappman 0.4__py3-none-any.whl → 0.5__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
@@ -14,6 +14,7 @@ Interactive, visual thin layer atop appman
14
14
  import os
15
15
  import sys
16
16
  import re
17
+ import shutil
17
18
  import subprocess
18
19
  import traceback
19
20
  import copy
@@ -38,7 +39,8 @@ class Vappman:
38
39
  spin = self.spin = OptionSpinner()
39
40
  spin.add_key('help_mode', '? - toggle help screen', vals=[False, True])
40
41
 
41
- other = 'ir/q'
42
+ # EXPAND
43
+ other = 'airbou/qscU'
42
44
  other_keys = set(ord(x) for x in other)
43
45
  self.opts = spin.default_obj
44
46
 
@@ -48,11 +50,27 @@ class Vappman:
48
50
  # self.verbs = {'i': 'install', 'r': 'remove', 'v': 'view',}
49
51
  self.prev_filter = '' # string
50
52
  self.filter = None # compiled pattern
53
+ self.check_preqreqs()
51
54
  self.apps = self.cmd_dict('appman list')
52
55
  self.installs = self.get_installed() # dict keyed by app
53
56
  self.win = Window(head_line=True, body_rows=len(self.apps)+20, head_rows=10,
54
57
  keys=spin.keys ^ other_keys, mod_pick=self.mod_pick)
55
58
 
59
+ @staticmethod
60
+ def check_preqreqs():
61
+ """ Check that needed programs are installed. """
62
+ ok = True
63
+ for prog in 'curl grep jq sed wget appman'.split():
64
+ if shutil.which(prog) is None:
65
+ ok = False
66
+ print(f'ERROR: cannot find {prog!r} on $PATH')
67
+ if prog == 'appman':
68
+ print('Install appman with:')
69
+ print("""mkdir -p ~/.local/bin && cd /tmp &&"""
70
+ """ wget https://raw.githubusercontent.com/ivan-hc/AM/main/APP-MANAGER"""
71
+ """ -O appman && chmod a+x ./appman && mv ./appman ~/.local/bin/appman""")
72
+ if not ok:
73
+ sys.exit(1)
56
74
 
57
75
  def cmd_dict(self, cmd, start='◆ '):
58
76
  """ Get lines with the given start."""
@@ -89,13 +107,22 @@ class Vappman:
89
107
  self.win.set_pick_mode(False)
90
108
  self.spin.show_help_nav_keys(self.win)
91
109
  self.spin.show_help_body(self.win)
110
+ # EXPAND
92
111
  lines = [
93
112
  'ALWAYS AVAILABLE:',
94
- ' / - filter apps',
95
113
  ' q - quit program (CTL-C disabled)',
114
+ ' a - about (more info about app)',
115
+ ' s - sync (update appman itself)',
116
+ ' c - clean (remove unneeded files/folters)',
117
+ ' U - update ALL installed apps',
118
+ ' / - filter apps',
96
119
  'CONTEXT SENSITIVE:',
97
120
  ' i - install uninstalled app',
98
121
  ' r - remove installed app',
122
+ ' b - backup installed app',
123
+ ' u - update installed app',
124
+ ' o - overwrite app from its backup',
125
+
99
126
  ]
100
127
  for line in lines:
101
128
  self.win.put_body(line)
@@ -122,11 +149,13 @@ class Vappman:
122
149
 
123
150
  def get_keys_line(self):
124
151
  """ TBD """
152
+ # EXPAND
125
153
  filt = self.prev_filter if self.prev_filter else '{No-Filt}'
126
154
  line = 'KEYS:'
127
155
  for key, verb in self.actions.items():
128
156
  line += f' {key}:{verb}'
129
- line += f' ?:help q:quit /{filt} '
157
+ # or EXPAND
158
+ line += f' ?:help q:quit a:about s:sync c:clean U:upd /{filt} '
130
159
  # for action in self.actions:
131
160
  # line += f' {action[0]}:{action}'
132
161
  return line
@@ -139,8 +168,12 @@ class Vappman:
139
168
  line = lines[self.win.pick_pos]
140
169
  app = self.get_word1(line)
141
170
  self.pick_is_installed = bool(app in self.installs)
171
+ # EXPAND
142
172
  if self.pick_is_installed:
143
- actions['r'] = 'remove'
173
+ actions['r'] = 'rmv'
174
+ actions['b'] = 'bkup'
175
+ actions['o'] = 'overwr'
176
+ actions['u'] = 'upd'
144
177
  else:
145
178
  actions['i'] = 'install'
146
179
 
@@ -170,6 +203,12 @@ class Vappman:
170
203
  # line = line[0:-over]
171
204
 
172
205
  # return line + suffix
206
+ def run_appman(self, cmd):
207
+ Window.stop_curses()
208
+ os.system(f'clear; stty sane; {cmd};'
209
+ + ' echo -e "\n\nHit ENTER to return to menu"; read FOO')
210
+ self.installs = self.get_installed()
211
+ Window._start_curses()
173
212
 
174
213
  def do_key(self, key):
175
214
  """ TBD """
@@ -201,23 +240,29 @@ class Vappman:
201
240
  sys.exit(0)
202
241
 
203
242
  if key == ord('i') and not self.pick_is_installed:
204
- # pylint: disable=protected-access
205
- Window.stop_curses()
206
- os.system(f'clear; stty sane; appman install {self.pick_app};'
207
- + ' echo -e "\n\nHit ENTER to return to menu"; read FOO')
208
- self.installs = self.get_installed()
209
- Window._start_curses()
243
+ self.run_appman(f'appman install {self.pick_app}')
210
244
  return None
211
245
 
212
246
  if key == ord('r') and self.pick_is_installed:
213
- # pylint: disable=protected-access
214
- Window.stop_curses()
215
- os.system(f'clear; stty sane; appman remove {self.pick_app};'
216
- + ' echo -e "\n\nHit ENTER to return to menu"; read FOO')
217
- self.installs = self.get_installed() # dict keyed by app
218
- Window._start_curses()
247
+ self.run_appman(f'appman remove {self.pick_app}')
219
248
  return None
220
249
 
250
+ if key == ord('s'):
251
+ self.run_appman('appman sync')
252
+ if key == ord('c'):
253
+ self.run_appman('appman clean')
254
+ if key == ord('b'):
255
+ self.run_appman(f'appman backup {self.pick_app}')
256
+ if key == ord('o'):
257
+ self.run_appman(f'appman overwrite {self.pick_app}')
258
+ if key == ord('a'):
259
+ self.run_appman(f'appman about {self.pick_app}')
260
+ if key == ord('u'):
261
+ self.run_appman(f'appman update {self.pick_app}')
262
+ if key == ord('U'):
263
+ self.run_appman(f'appman update')
264
+ # EXPAND
265
+
221
266
  if key == ord('/'):
222
267
  # pylint: disable=protected-access
223
268
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: vappman
3
- Version: 0.4
3
+ Version: 0.5
4
4
  Summary: A visual wrapper for appman
5
5
  Author-email: Joe Defen <joedef@google.com>
6
6
  License: MIT
@@ -22,11 +22,25 @@ Requires-Dist: importlib-metadata ; python_version < "3.8"
22
22
  * Install `vappman` using `pipx install vappman`, or however you do so.
23
23
  * Prerequisites: install [ivan-hc/AppMan: AppImage package manager to install, update (for real) and manage ALL of them locally thanks to "AM", the ever-growing AUR-inspired database listing (for now) 1900+ portable apps and programs for GNU/Linux. Manage your AppImages with the ease of APT and the power of PacMan.](https://github.com/ivan-hc/AppMan) and all of its prerequisites.
24
24
 
25
- NOTE: `vappman` is in a very preliminary state,
26
- but it implements the most needed, basic functionality:
27
- * filtering the app list
28
- * installing new apps
29
- * removing installed apps
25
+ NOTE: `vappman` covers many capabilities of appman:
26
+ * implicitly, (-f) files (or show installed), (-l) list available apps,
27
+ and (-q) search the app list
28
+ * (-i) installing uninstalled apps
29
+ * (-r) removing installed apps
30
+ * (-b) backup / (-o) overwrite of installed apps
31
+ * (-a) about (i.e., more info) for all apps
32
+ * (-c) clean to remove unneeded files and directories
33
+ * (-u) update installed apps; and `vappman` uses "U" for update
34
+ all installed apps
35
+
36
+ But it does NOT cover:
37
+ * (-d) download install script
38
+ * (-h) help or full help for appman
39
+ * (-H) home or set $HOME directory for apps
40
+ * (-t) template for custom install template
41
+ * (-v) version of appman
42
+ * --force-latest to get the most recent stable release AND
43
+ all other options and unmentioned commands.
30
44
 
31
45
  ## Usage
32
46
  * Run `vappman` from the command line.
@@ -46,7 +60,7 @@ but it implements the most needed, basic functionality:
46
60
 
47
61
  ---
48
62
 
49
- NOTES:
63
+ NOTES: in this example:
50
64
  * the filter is `card` so it shows apps with words starting with `card`.
51
65
  * the current position is on `glabels`; thus if `i` is typed, `appman install glabels` is run.
52
66
  * if the horizontal line (second line show) has no decorations, then you are looking
@@ -0,0 +1,9 @@
1
+ vappman/PowerWindow.py,sha256=OLCX-RkbJZ2wwaY7M-4Eo9PQuR95TWrGNIY8DdVRpsE,28567
2
+ vappman/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
+ vappman/main.py,sha256=1sbpuJQZpTMBjbFeb9hOCxCvAw1aXOq4SMaobEt0BH8,10951
4
+ vappman-0.5.dist-info/LICENSE,sha256=qB9OdnyyF6WYHiEIXVm0rOSdcf8e2ctorrtWs6CC5lU,1062
5
+ vappman-0.5.dist-info/METADATA,sha256=8Fvf5IBmf-6zWious1_hrz7QXE3I4k-8Zb_HQ6c1Iw0,3356
6
+ vappman-0.5.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
7
+ vappman-0.5.dist-info/entry_points.txt,sha256=7_1MiUvkCJoElLePOCJYqhkQN4xmadBRQCKupOwzt90,46
8
+ vappman-0.5.dist-info/top_level.txt,sha256=5_Gb5oZh7s2-i62gLXZ6INVALAV9D0-yqh0TvNqpPC4,8
9
+ vappman-0.5.dist-info/RECORD,,
@@ -1,9 +0,0 @@
1
- vappman/PowerWindow.py,sha256=OLCX-RkbJZ2wwaY7M-4Eo9PQuR95TWrGNIY8DdVRpsE,28567
2
- vappman/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
- vappman/main.py,sha256=AhLwXlidafcrB-g5-6OONwaLW_JhAxCSsZq8derbZ_8,9221
4
- vappman-0.4.dist-info/LICENSE,sha256=qB9OdnyyF6WYHiEIXVm0rOSdcf8e2ctorrtWs6CC5lU,1062
5
- vappman-0.4.dist-info/METADATA,sha256=oTTGUtaApTjDeloLWTJyTmDobEAoqNNikJB7c3_nPRk,2749
6
- vappman-0.4.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
7
- vappman-0.4.dist-info/entry_points.txt,sha256=7_1MiUvkCJoElLePOCJYqhkQN4xmadBRQCKupOwzt90,46
8
- vappman-0.4.dist-info/top_level.txt,sha256=5_Gb5oZh7s2-i62gLXZ6INVALAV9D0-yqh0TvNqpPC4,8
9
- vappman-0.4.dist-info/RECORD,,
File without changes
File without changes