wizlib 3.0.0__tar.gz → 3.0.1__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.

Potentially problematic release.


This version of wizlib might be problematic. Click here for more details.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: wizlib
3
- Version: 3.0.0
3
+ Version: 3.0.1
4
4
  Summary: Framework for flexible and powerful command-line applications
5
5
  License: MIT
6
6
  Author: Steampunk Wizard
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "wizlib"
3
- version = "3.0.0"
3
+ version = "3.0.1"
4
4
  description = "Framework for flexible and powerful command-line applications"
5
5
  authors = ["Steampunk Wizard <wizlib@steampunkwizard.ca>"]
6
6
  license = "MIT"
@@ -1,3 +1,5 @@
1
+ # Note that commands once used dataclass, but no longer.
2
+
1
3
  from argparse import ArgumentParser
2
4
  from pathlib import Path
3
5
 
@@ -16,8 +18,7 @@ class WizCommand(ClassFamily, SuperWrapper):
16
18
  """Define all the args you want, but stdin always works."""
17
19
 
18
20
  status = ''
19
- handlers = []
20
- ui: UI = None
21
+ handlers = [] # TODO: Move to app
21
22
 
22
23
  @classmethod
23
24
  def add_args(self, parser):
@@ -127,12 +127,12 @@ class Chooser(Prompt):
127
127
  self.choices.append(choice)
128
128
 
129
129
  def choice_by_key(self, key):
130
- if key == '\n':
131
- choice = self.default
130
+ if key == '\n' and self.default:
131
+ choice = self.choices[0].value
132
132
  else:
133
133
  choice = next(
134
134
  (o.value for o in self.choices if key in o.keys), None)
135
- return choice() if callable(choice) else choice
135
+ return choice
136
136
 
137
137
  def choices_by_text(self, text):
138
138
  return [o.value for o in self.choices if o.hit_text(text)]
@@ -54,7 +54,7 @@ class ShellUI(UI):
54
54
  self.send(out, emphasis=emphasis)
55
55
  if choice is not None:
56
56
  break
57
- return choice
57
+ return choice() if callable(choice) else choice
58
58
 
59
59
  def get_text(self, prompt='', choices=[], default=''):
60
60
  """Allow the user to input an arbitrary line of text, with possible tab
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