Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F57027087
main.rs
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
main.rs
View Options
use
clap
::
Parser
;
use
crate
::
registry
::
get_registry
;
use
crate
::
language_parser
::
Language
;
mod
registry
;
mod
language_parser
;
#[derive(Debug, Parser)]
#[command(name =
"language-subtag-registry-datasource"
)]
#[clap(author=
"Nasqueron project"
, version, about=
"Download and print language subtag registry"
, long_about=None)]
pub
struct
Args
{
/// The format string to use
#[arg(long, short = 'f')]
format
:
String
,
/// The aggregation separator
#[arg(long, short = 'a', default_value =
" / "
)]
aggregation_separator
:
String
,
/// The path to the registry source
#[arg(long, short = 's')]
source
:
Option
<
String
>
,
/// Restricts parsing to language type
#[arg(long, short = 'l', default_value_t = false)]
languages_only
:
bool
,
}
#[tokio::main]
async
fn
main
()
{
let
args
=
Args
::
parse
();
// Will exit if argument is missing or --help/--version provided.
let
document
=
get_registry
(
args
.
source
).
await
.
expect
(
"Can't read or fetch registry"
);
for
language
in
Language
::
parse_document
(
&
document
,
args
.
languages_only
)
{
println!
(
"{}"
,
language
.
format
(
&
args
.
format
,
&
args
.
aggregation_separator
));
}
}
File Metadata
Details
Attached
Mime Type
text/x-c
Expires
Sun, Nov 15, 04:42 (6 d, 15 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
4252553
Default Alt Text
main.rs (1 KB)
Attached To
Mode
rDS Nasqueron Datasources
Attached
Detach File
Event Timeline
Log In to Comment