dronefly-cli 0.3.0__tar.gz → 0.3.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.
- {dronefly_cli-0.3.0 → dronefly_cli-0.3.1}/PKG-INFO +14 -10
- {dronefly_cli-0.3.0 → dronefly_cli-0.3.1}/README.md +10 -6
- {dronefly_cli-0.3.0 → dronefly_cli-0.3.1}/dronefly_cli/main.py +26 -3
- {dronefly_cli-0.3.0 → dronefly_cli-0.3.1}/pyproject.toml +4 -5
- {dronefly_cli-0.3.0 → dronefly_cli-0.3.1}/uv.lock +1 -1
- {dronefly_cli-0.3.0 → dronefly_cli-0.3.1}/.gitignore +0 -0
- {dronefly_cli-0.3.0 → dronefly_cli-0.3.1}/.pre-commit-config.yaml +0 -0
- {dronefly_cli-0.3.0 → dronefly_cli-0.3.1}/LICENSE +0 -0
- {dronefly_cli-0.3.0 → dronefly_cli-0.3.1}/dronefly_cli/__init__.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
2
|
Name: dronefly-cli
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.1
|
|
4
4
|
Summary: Dronefly command-line interface
|
|
5
5
|
Author-email: Ben Armstrong <synrg@debian.org>
|
|
6
6
|
License-Expression: AGPL-3.0-or-later
|
|
@@ -9,9 +9,9 @@ Classifier: Programming Language :: Python :: 3
|
|
|
9
9
|
Classifier: Programming Language :: Python :: 3.11
|
|
10
10
|
Classifier: Programming Language :: Python :: 3.12
|
|
11
11
|
Requires-Python: <3.13,>=3.11
|
|
12
|
-
Requires-Dist: dronefly-core>=0.5.
|
|
12
|
+
Requires-Dist: dronefly-core>=0.5.3
|
|
13
13
|
Requires-Dist: pyreadline3<4,>=3.4.1
|
|
14
|
-
Requires-Dist: rich<
|
|
14
|
+
Requires-Dist: rich<15,>=13.2
|
|
15
15
|
Description-Content-Type: text/markdown
|
|
16
16
|
|
|
17
17
|
# Dronefly command-line client
|
|
@@ -20,17 +20,21 @@ The dronefly-cli command-line client will provide a standalone text user
|
|
|
20
20
|
interface that can perform a usable subset of Dronefly Discord bot's
|
|
21
21
|
capabilities, built solely with Dronefly core.
|
|
22
22
|
|
|
23
|
-
# Installation
|
|
23
|
+
# Installation
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
The fastest and most reliable way to get up and running with `dronefly-cli` is
|
|
26
|
+
with `uvx`:
|
|
27
|
+
|
|
28
|
+
1. First install `uv`: https://docs.astral.sh/uv
|
|
29
|
+
2. Run it with `uvx`:
|
|
26
30
|
|
|
27
31
|
```sh
|
|
28
|
-
$
|
|
29
|
-
$ dronefly
|
|
32
|
+
$ uvx --from dronefly-cli dronefly
|
|
30
33
|
```
|
|
31
34
|
|
|
32
|
-
If all went well,
|
|
33
|
-
|
|
35
|
+
If all went well, it will fetch any dependencies, initialize the environment,
|
|
36
|
+
and run the `dronefly` cli. You should arrive at a Dronefly `(=)` prompt where
|
|
37
|
+
you can test it with the `taxon` command to look up taxa by name. For example:
|
|
34
38
|
|
|
35
39
|
$\tt\textcolor{gold}{(=)}$ taxon picoides pubescens \
|
|
36
40
|
[*Dryobates pubescens* (Downy Woodpecker)](https://www.inaturalist.org/taxa/792988-Dryobates-pubescens) (~~Picoides pubescens~~) \
|
|
@@ -4,17 +4,21 @@ The dronefly-cli command-line client will provide a standalone text user
|
|
|
4
4
|
interface that can perform a usable subset of Dronefly Discord bot's
|
|
5
5
|
capabilities, built solely with Dronefly core.
|
|
6
6
|
|
|
7
|
-
# Installation
|
|
7
|
+
# Installation
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
The fastest and most reliable way to get up and running with `dronefly-cli` is
|
|
10
|
+
with `uvx`:
|
|
11
|
+
|
|
12
|
+
1. First install `uv`: https://docs.astral.sh/uv
|
|
13
|
+
2. Run it with `uvx`:
|
|
10
14
|
|
|
11
15
|
```sh
|
|
12
|
-
$
|
|
13
|
-
$ dronefly
|
|
16
|
+
$ uvx --from dronefly-cli dronefly
|
|
14
17
|
```
|
|
15
18
|
|
|
16
|
-
If all went well,
|
|
17
|
-
|
|
19
|
+
If all went well, it will fetch any dependencies, initialize the environment,
|
|
20
|
+
and run the `dronefly` cli. You should arrive at a Dronefly `(=)` prompt where
|
|
21
|
+
you can test it with the `taxon` command to look up taxa by name. For example:
|
|
18
22
|
|
|
19
23
|
$\tt\textcolor{gold}{(=)}$ taxon picoides pubescens \
|
|
20
24
|
[*Dryobates pubescens* (Downy Woodpecker)](https://www.inaturalist.org/taxa/792988-Dryobates-pubescens) (~~Picoides pubescens~~) \
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env python
|
|
2
2
|
import asyncio
|
|
3
|
+
import io
|
|
3
4
|
import os
|
|
5
|
+
import re
|
|
4
6
|
import sys
|
|
5
7
|
import readline
|
|
6
8
|
from inspect import getmembers, isroutine
|
|
@@ -12,12 +14,23 @@ from dronefly.core.constants import INAT_USER_DEFAULT_PARAMS
|
|
|
12
14
|
from rich.console import Console
|
|
13
15
|
from rich.markdown import Markdown
|
|
14
16
|
|
|
15
|
-
|
|
16
17
|
console = Console()
|
|
17
18
|
histfile = os.path.expanduser("~/.dronefly_history")
|
|
18
19
|
histfile_size = 1000
|
|
19
20
|
|
|
20
21
|
|
|
22
|
+
def get_styled_prompt_str(markup: str = "[bold gold1](=)[/bold gold1] ") -> str:
|
|
23
|
+
"""Renders Rich markup into a raw ANSI prompt string safely."""
|
|
24
|
+
buffer = io.StringIO()
|
|
25
|
+
temp_console = Console(file=buffer, force_terminal=True)
|
|
26
|
+
temp_console.print(markup, end="")
|
|
27
|
+
raw_prompt = buffer.getvalue()
|
|
28
|
+
|
|
29
|
+
# Apply GNU readline non-printing wrappers (\001 and \002) if needed
|
|
30
|
+
# - See: Textualize/rich#2293
|
|
31
|
+
return re.sub(r"(\x1b\[[0-9;]*m)", r"\001\1\002", raw_prompt)
|
|
32
|
+
|
|
33
|
+
|
|
21
34
|
async def help(ctx, *args):
|
|
22
35
|
"""Show help
|
|
23
36
|
Usage:
|
|
@@ -128,9 +141,19 @@ async def start_command_loop(commands, ctx, histfile, histfile_size):
|
|
|
128
141
|
try:
|
|
129
142
|
read_history(histfile)
|
|
130
143
|
|
|
144
|
+
prompt = "[bold gold1](=)[/bold gold1] "
|
|
145
|
+
use_readline_wrappers = getattr(readline, "backend", "readline") == "readline"
|
|
146
|
+
prompt_str = get_styled_prompt_str(prompt) if use_readline_wrappers else None
|
|
147
|
+
|
|
131
148
|
while True:
|
|
132
|
-
|
|
133
|
-
|
|
149
|
+
try:
|
|
150
|
+
if prompt_str:
|
|
151
|
+
_line = input(prompt_str).rstrip()
|
|
152
|
+
else:
|
|
153
|
+
console.print(prompt, end="")
|
|
154
|
+
_line = input().rstrip()
|
|
155
|
+
except EOFError:
|
|
156
|
+
raise EOFError
|
|
134
157
|
if not _line:
|
|
135
158
|
if not ctx.page_formatter:
|
|
136
159
|
continue
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "dronefly-cli"
|
|
3
|
-
version = "0.3.
|
|
3
|
+
version = "0.3.1"
|
|
4
4
|
description = "Dronefly command-line interface"
|
|
5
5
|
authors = [{ name = "Ben Armstrong", email = "synrg@debian.org" }]
|
|
6
6
|
requires-python = ">=3.11,<3.13"
|
|
@@ -13,8 +13,8 @@ classifiers = [
|
|
|
13
13
|
]
|
|
14
14
|
dependencies = [
|
|
15
15
|
"pyreadline3>=3.4.1,<4",
|
|
16
|
-
"dronefly-core>=0.5.
|
|
17
|
-
"rich>=13.2,<
|
|
16
|
+
"dronefly-core>=0.5.3",
|
|
17
|
+
"rich>=13.2,<15",
|
|
18
18
|
]
|
|
19
19
|
|
|
20
20
|
[project.scripts]
|
|
@@ -50,8 +50,7 @@ allow-direct-references = true
|
|
|
50
50
|
packages = ["dronefly_cli"]
|
|
51
51
|
|
|
52
52
|
[tool.uv.sources]
|
|
53
|
-
|
|
54
|
-
# dronefly-core = { path = "../dronefly-core" }
|
|
53
|
+
dronefly-cli = { workspace = true }
|
|
55
54
|
|
|
56
55
|
[tool.setuptools]
|
|
57
56
|
packages = ["dronefly_cli"]
|
|
@@ -277,7 +277,7 @@ dev = [
|
|
|
277
277
|
requires-dist = [
|
|
278
278
|
{ name = "dronefly-core", specifier = ">=0.5.2" },
|
|
279
279
|
{ name = "pyreadline3", specifier = ">=3.4.1,<4" },
|
|
280
|
-
{ name = "rich", specifier = ">=13.2,<
|
|
280
|
+
{ name = "rich", specifier = ">=13.2,<15" },
|
|
281
281
|
]
|
|
282
282
|
|
|
283
283
|
[package.metadata.requires-dev]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|