countrycodes-cli 1.0.0__tar.gz → 1.1.0__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.
- {countrycodes_cli-1.0.0 → countrycodes_cli-1.1.0}/PKG-INFO +16 -7
- {countrycodes_cli-1.0.0 → countrycodes_cli-1.1.0}/README.md +14 -5
- {countrycodes_cli-1.0.0 → countrycodes_cli-1.1.0}/pyproject.toml +2 -2
- {countrycodes_cli-1.0.0 → countrycodes_cli-1.1.0}/pyproject.toml.orig +2 -2
- {countrycodes_cli-1.0.0 → countrycodes_cli-1.1.0}/src/countrycodes_cli/cli.py +34 -15
- {countrycodes_cli-1.0.0 → countrycodes_cli-1.1.0}/LICENSE +0 -0
- {countrycodes_cli-1.0.0 → countrycodes_cli-1.1.0}/src/countrycodes_cli/__init__.py +0 -0
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: countrycodes-cli
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.1.0
|
|
4
4
|
Summary: Command-line interface for the countrycodes library
|
|
5
5
|
License-Expression: BSD-3-Clause
|
|
6
6
|
License-File: LICENSE
|
|
7
|
-
Requires-Dist: countrycodes==1.
|
|
7
|
+
Requires-Dist: countrycodes==1.1.0
|
|
8
8
|
Requires-Dist: rich>=13.7.1
|
|
9
9
|
Requires-Dist: typer>=0.24.1
|
|
10
10
|
Requires-Python: >=3.11
|
|
@@ -66,16 +66,24 @@ truncated, the CLI notes that it is showing only the top matches. JSON lookup
|
|
|
66
66
|
output is a single record for one match or an array for multiple matches. The
|
|
67
67
|
default list is rendered as a table sorted by alpha-2 code, with a row number,
|
|
68
68
|
and JSON list output is an unnumbered array. Text tables show a country's
|
|
69
|
-
common name when available, falling back to its source name.
|
|
70
|
-
|
|
69
|
+
common name when available, falling back to its source name. The tables include
|
|
70
|
+
the international dial code and separate Standard UTC Offset and Daylight UTC
|
|
71
|
+
Offset columns. Each shows distinct numeric-hour offsets across mapped regions,
|
|
72
|
+
sorted numerically. For example, standard offsets can be `-7, -6`, while
|
|
73
|
+
daylight offsets can be `+5.5, +5.75`. Positive offsets include a plus sign;
|
|
74
|
+
zero is shown as `0`. Countries without daylight saving—or without source
|
|
75
|
+
offset data—display `NULL` in the daylight column. Fuzzy text lookup tables
|
|
71
76
|
include a combined word-level and full displayed-name similarity percentage
|
|
72
77
|
for each result. Fuzzy matching uses transposition-aware edit-distance scoring.
|
|
73
78
|
Country name data is retained as provided by its source; inclusion does not
|
|
74
79
|
imply endorsement of any political position.
|
|
75
80
|
|
|
76
|
-
|
|
81
|
+
The version command prints the CLI name and installed `countrycodes` library
|
|
82
|
+
version, for example `countrycodes 1.0.0`. See it and all available options
|
|
83
|
+
with:
|
|
77
84
|
|
|
78
85
|
```console
|
|
86
|
+
countrycodes --version
|
|
79
87
|
countrycodes --help
|
|
80
88
|
```
|
|
81
89
|
|
|
@@ -83,5 +91,6 @@ countrycodes --help
|
|
|
83
91
|
|
|
84
92
|
The CLI code is licensed under BSD 3-Clause. The separately distributed
|
|
85
93
|
`countrycodes` library includes ISO registry data under LGPL-2.1-or-later and
|
|
86
|
-
continent assignments
|
|
87
|
-
|
|
94
|
+
continent assignments, dial codes, and standard and daylight-saving UTC
|
|
95
|
+
offsets from GeoNames under CC BY 4.0; installing the CLI installs that library
|
|
96
|
+
as a dependency.
|
|
@@ -54,16 +54,24 @@ truncated, the CLI notes that it is showing only the top matches. JSON lookup
|
|
|
54
54
|
output is a single record for one match or an array for multiple matches. The
|
|
55
55
|
default list is rendered as a table sorted by alpha-2 code, with a row number,
|
|
56
56
|
and JSON list output is an unnumbered array. Text tables show a country's
|
|
57
|
-
common name when available, falling back to its source name.
|
|
58
|
-
|
|
57
|
+
common name when available, falling back to its source name. The tables include
|
|
58
|
+
the international dial code and separate Standard UTC Offset and Daylight UTC
|
|
59
|
+
Offset columns. Each shows distinct numeric-hour offsets across mapped regions,
|
|
60
|
+
sorted numerically. For example, standard offsets can be `-7, -6`, while
|
|
61
|
+
daylight offsets can be `+5.5, +5.75`. Positive offsets include a plus sign;
|
|
62
|
+
zero is shown as `0`. Countries without daylight saving—or without source
|
|
63
|
+
offset data—display `NULL` in the daylight column. Fuzzy text lookup tables
|
|
59
64
|
include a combined word-level and full displayed-name similarity percentage
|
|
60
65
|
for each result. Fuzzy matching uses transposition-aware edit-distance scoring.
|
|
61
66
|
Country name data is retained as provided by its source; inclusion does not
|
|
62
67
|
imply endorsement of any political position.
|
|
63
68
|
|
|
64
|
-
|
|
69
|
+
The version command prints the CLI name and installed `countrycodes` library
|
|
70
|
+
version, for example `countrycodes 1.0.0`. See it and all available options
|
|
71
|
+
with:
|
|
65
72
|
|
|
66
73
|
```console
|
|
74
|
+
countrycodes --version
|
|
67
75
|
countrycodes --help
|
|
68
76
|
```
|
|
69
77
|
|
|
@@ -71,5 +79,6 @@ countrycodes --help
|
|
|
71
79
|
|
|
72
80
|
The CLI code is licensed under BSD 3-Clause. The separately distributed
|
|
73
81
|
`countrycodes` library includes ISO registry data under LGPL-2.1-or-later and
|
|
74
|
-
continent assignments
|
|
75
|
-
|
|
82
|
+
continent assignments, dial codes, and standard and daylight-saving UTC
|
|
83
|
+
offsets from GeoNames under CC BY 4.0; installing the CLI installs that library
|
|
84
|
+
as a dependency.
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "countrycodes-cli"
|
|
3
|
-
version = "1.
|
|
3
|
+
version = "1.1.0"
|
|
4
4
|
description = "Command-line interface for the countrycodes library"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
requires-python = ">=3.11"
|
|
7
7
|
license = "BSD-3-Clause"
|
|
8
8
|
license-files = ["LICENSE"]
|
|
9
9
|
dependencies = [
|
|
10
|
-
"countrycodes==1.
|
|
10
|
+
"countrycodes==1.1.0",
|
|
11
11
|
"rich>=13.7.1",
|
|
12
12
|
"typer>=0.24.1",
|
|
13
13
|
]
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "countrycodes-cli"
|
|
3
|
-
version = "1.
|
|
3
|
+
version = "1.1.0"
|
|
4
4
|
description = "Command-line interface for the countrycodes library"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
requires-python = ">=3.11"
|
|
7
7
|
license = "BSD-3-Clause"
|
|
8
8
|
license-files = ["LICENSE"]
|
|
9
|
-
dependencies = ["countrycodes==1.
|
|
9
|
+
dependencies = ["countrycodes==1.1.0", "rich>=13.7.1", "typer>=0.24.1"]
|
|
10
10
|
|
|
11
11
|
[project.scripts]
|
|
12
12
|
countrycodes = "countrycodes_cli.cli:app"
|
|
@@ -19,7 +19,7 @@ def main(
|
|
|
19
19
|
] = False,
|
|
20
20
|
) -> None:
|
|
21
21
|
if version:
|
|
22
|
-
typer.echo(cc.__version__)
|
|
22
|
+
typer.echo(f"{cc.__name__} {cc.__version__}")
|
|
23
23
|
raise typer.Exit()
|
|
24
24
|
|
|
25
25
|
|
|
@@ -96,8 +96,10 @@ def lookup(
|
|
|
96
96
|
table.add_column("Alpha-3")
|
|
97
97
|
table.add_column("Numeric")
|
|
98
98
|
table.add_column("Dial Code")
|
|
99
|
-
table.add_column("
|
|
100
|
-
table.add_column("
|
|
99
|
+
table.add_column("Standard UTC Offset", overflow="fold", max_width=18)
|
|
100
|
+
table.add_column("Daylight UTC Offset", overflow="fold", max_width=18)
|
|
101
|
+
table.add_column("Continent", overflow="fold", max_width=11, min_width=9)
|
|
102
|
+
table.add_column("Country", overflow="fold")
|
|
101
103
|
if is_fuzzy_lookup:
|
|
102
104
|
table.add_column("Similarity", justify="right", no_wrap=True)
|
|
103
105
|
for country in countries:
|
|
@@ -106,6 +108,12 @@ def lookup(
|
|
|
106
108
|
country.alpha3,
|
|
107
109
|
country.numeric,
|
|
108
110
|
country.dial_code or "[dim]NULL[/dim]",
|
|
111
|
+
_format_utc_offsets(country.standard_utc_offsets)
|
|
112
|
+
if country.standard_utc_offsets is not None
|
|
113
|
+
else "[dim]NULL[/dim]",
|
|
114
|
+
_format_utc_offsets(country.daylight_utc_offsets)
|
|
115
|
+
if country.daylight_utc_offsets is not None
|
|
116
|
+
else "[dim]NULL[/dim]",
|
|
109
117
|
country.continent,
|
|
110
118
|
country.display_name,
|
|
111
119
|
)
|
|
@@ -113,7 +121,7 @@ def lookup(
|
|
|
113
121
|
score = cc.country_name_similarity(query, country)
|
|
114
122
|
row += (f"{score:.1%}",)
|
|
115
123
|
table.add_row(*row)
|
|
116
|
-
Console().print(table)
|
|
124
|
+
Console(width=140).print(table)
|
|
117
125
|
if has_more_matches:
|
|
118
126
|
Console().print(f"[dim]Showing only the top {limit} matches.[/dim]")
|
|
119
127
|
|
|
@@ -135,16 +143,16 @@ def list_countries(
|
|
|
135
143
|
)
|
|
136
144
|
)
|
|
137
145
|
else:
|
|
138
|
-
table = Table(
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
)
|
|
146
|
+
table = Table(show_lines=False)
|
|
147
|
+
table.add_column("#")
|
|
148
|
+
table.add_column("Alpha-2")
|
|
149
|
+
table.add_column("Alpha-3")
|
|
150
|
+
table.add_column("Numeric")
|
|
151
|
+
table.add_column("Dial Code")
|
|
152
|
+
table.add_column("Standard UTC Offset", overflow="fold", max_width=18)
|
|
153
|
+
table.add_column("Daylight UTC Offset", overflow="fold", max_width=18)
|
|
154
|
+
table.add_column("Continent", overflow="fold", max_width=11, min_width=9)
|
|
155
|
+
table.add_column("Country", overflow="fold")
|
|
148
156
|
for index, country in enumerate(countries, start=1):
|
|
149
157
|
table.add_row(
|
|
150
158
|
str(index),
|
|
@@ -152,12 +160,23 @@ def list_countries(
|
|
|
152
160
|
country.alpha3,
|
|
153
161
|
country.numeric,
|
|
154
162
|
country.dial_code or "[dim]NULL[/dim]",
|
|
163
|
+
_format_utc_offsets(country.standard_utc_offsets)
|
|
164
|
+
if country.standard_utc_offsets is not None
|
|
165
|
+
else "[dim]NULL[/dim]",
|
|
166
|
+
_format_utc_offsets(country.daylight_utc_offsets)
|
|
167
|
+
if country.daylight_utc_offsets is not None
|
|
168
|
+
else "[dim]NULL[/dim]",
|
|
155
169
|
country.continent,
|
|
156
170
|
country.display_name,
|
|
157
171
|
)
|
|
158
|
-
Console().print(table)
|
|
172
|
+
Console(width=140).print(table)
|
|
159
173
|
|
|
160
174
|
|
|
161
175
|
def _normalize_query(value: str) -> str:
|
|
162
176
|
"""Return normalized text using the library's whitespace and case rules."""
|
|
163
177
|
return " ".join(value.casefold().split())
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
def _format_utc_offsets(offsets: tuple[float, ...]) -> str:
|
|
181
|
+
"""Render UTC offsets in numeric hours, with an explicit positive sign."""
|
|
182
|
+
return ", ".join("0" if offset == 0 else f"{offset:+g}" for offset in offsets)
|
|
File without changes
|
|
File without changes
|