dronefly-cli 0.2.5__tar.gz → 0.2.7__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: dronefly-cli
3
- Version: 0.2.5
3
+ Version: 0.2.7
4
4
  Summary: Dronefly command-line interface
5
5
  License: AGPL-3.0-or-later
6
6
  Author: Ben Armstrong
@@ -9,7 +9,7 @@ Requires-Python: >=3.11,<3.13
9
9
  Classifier: License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)
10
10
  Classifier: Programming Language :: Python :: 3
11
11
  Classifier: Programming Language :: Python :: 3.11
12
- Requires-Dist: dronefly-core (==0.3.9)
12
+ Requires-Dist: dronefly-core (==0.4.2)
13
13
  Requires-Dist: pyreadline3 (>=3.4.1,<4.0.0)
14
14
  Requires-Dist: rich (>=13.2,<14.0)
15
15
  Description-Content-Type: text/markdown
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env python
2
+ import asyncio
2
3
  import os
3
4
  import sys
4
5
  import readline
@@ -16,7 +17,7 @@ histfile = os.path.expanduser("~/.dronefly_history")
16
17
  histfile_size = 1000
17
18
 
18
19
 
19
- def do_command(command_str: str, ctx: Context, *args):
20
+ async def do_command(command_str: str, ctx: Context, *args):
20
21
  try:
21
22
  command = None
22
23
  _args = [*args]
@@ -38,9 +39,9 @@ def do_command(command_str: str, ctx: Context, *args):
38
39
  raise ArgumentError("Too many arguments")
39
40
  # Argument conversion, if necessary:
40
41
  if command_str in ["page", "sel"] and len(_args):
41
- response = command(ctx, int(_args[0]))
42
+ response = await command(ctx, int(_args[0]))
42
43
  else:
43
- response = command(ctx, *_args)
44
+ response = await command(ctx, *_args)
44
45
  if isinstance(response, list):
45
46
  console.print(*response)
46
47
  else:
@@ -79,7 +80,7 @@ def write_history(histfile, histfile_size):
79
80
  readline.write_history_file(histfile)
80
81
 
81
82
 
82
- def start_command_loop(ctx, histfile, histfile_size):
83
+ async def start_command_loop(ctx, histfile, histfile_size):
83
84
  try:
84
85
  read_history(histfile)
85
86
 
@@ -96,23 +97,27 @@ def start_command_loop(ctx, histfile, histfile_size):
96
97
  args = _line.split(" ")
97
98
  command = args[0]
98
99
  args.remove(command)
99
- do_command(command, ctx, *args)
100
+ await do_command(command, ctx, *args)
100
101
  except (KeyboardInterrupt, EOFError):
101
102
  write_history(histfile, histfile_size)
102
103
  console.print()
103
104
 
104
105
 
105
- def main():
106
+ async def start():
106
107
  ctx = get_context()
107
108
 
108
109
  if len(sys.argv) == 1:
109
110
  ctx.per_page = 20
110
- start_command_loop(ctx, histfile, histfile_size)
111
+ await start_command_loop(ctx, histfile, histfile_size)
111
112
  else:
112
113
  ctx.per_page = 0
113
114
  command = sys.argv[1]
114
115
  args = sys.argv[2:]
115
- do_command(command, ctx, *args)
116
+ await do_command(command, ctx, *args)
117
+
118
+
119
+ def main():
120
+ asyncio.run(start())
116
121
 
117
122
 
118
123
  if __name__ == "__main__":
@@ -6,7 +6,7 @@ exclude_dirs = ["tests"]
6
6
 
7
7
  [tool.poetry]
8
8
  name = "dronefly-cli"
9
- version = "0.2.5"
9
+ version = "0.2.7"
10
10
  description = "Dronefly command-line interface"
11
11
  authors = ["Ben Armstrong <synrg@debian.org>"]
12
12
  license = "AGPL-3.0-or-later"
@@ -15,7 +15,7 @@ readme = "README.md"
15
15
  [tool.poetry.dependencies]
16
16
  python = ">=3.11,<3.13"
17
17
  pyreadline3 = "^3.4.1"
18
- dronefly-core = "0.3.9"
18
+ dronefly-core = "0.4.2"
19
19
  rich = "^13.2"
20
20
 
21
21
  [tool.poetry.dev-dependencies]
File without changes
File without changes