Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit b61f4fe

Browse filesBrowse files
committed
Upgrade clap to v3
1 parent 71d6c0e commit b61f4fe
Copy full SHA for b61f4fe

File tree

Expand file treeCollapse file tree

5 files changed

+110
-114
lines changed
Filter options
Expand file treeCollapse file tree

5 files changed

+110
-114
lines changed

‎Cargo.lock

Copy file name to clipboardExpand all lines: Cargo.lock
+30-25Lines changed: 30 additions & 25 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎Cargo.toml

Copy file name to clipboardExpand all lines: Cargo.toml
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ ssl-vendor = ["rustpython-stdlib/ssl-vendor"]
3333
[dependencies]
3434
log = "0.4"
3535
env_logger = { version = "0.9.0", default-features = false, features = ["atty", "termcolor"] }
36-
clap = "2.33"
36+
clap = "3"
3737
rustpython-compiler = { path = "compiler/porcelain", version = "0.1.1" }
3838
rustpython-parser = { path = "parser", version = "0.1.1" }
3939
rustpython-vm = { path = "vm", version = "0.1.1", default-features = false, features = ["compile-parse"] }

‎examples/dis.rs

Copy file name to clipboardExpand all lines: examples/dis.rs
+18-19Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
/// This an example usage of the rustpython_compiler crate.
2-
/// This program reads, parses, and compiles a file you provide
3-
/// to RustPython bytecode, and then displays the output in the
4-
/// `dis.dis` format.
5-
///
6-
/// example usage:
7-
/// $ cargo run --release --example dis demo*.py
1+
//! This an example usage of the rustpython_compiler crate.
2+
//! This program reads, parses, and compiles a file you provide
3+
//! to RustPython bytecode, and then displays the output in the
4+
//! `dis.dis` format.
5+
//!
6+
//! example usage:
7+
//! $ cargo run --release --example dis demo*.py
88
9-
#[macro_use]
109
extern crate clap;
1110
extern crate env_logger;
1211
#[macro_use]
@@ -22,38 +21,38 @@ use std::path::Path;
2221
fn main() {
2322
env_logger::init();
2423
let app = App::new("dis")
25-
.version(crate_version!())
26-
.author(crate_authors!())
24+
.version(env!("CARGO_PKG_VERSION"))
25+
.author(env!("CARGO_PKG_AUTHORS"))
2726
.about("Compiles and disassembles python script files for viewing their bytecode.")
2827
.arg(
29-
Arg::with_name("scripts")
28+
Arg::new("scripts")
3029
.help("Scripts to scan")
31-
.multiple(true)
30+
.multiple_values(true)
3231
.required(true),
3332
)
3433
.arg(
35-
Arg::with_name("mode")
34+
Arg::new("mode")
3635
.help("The mode to compile the scripts in")
3736
.long("mode")
38-
.short("m")
37+
.short('m')
3938
.default_value("exec")
4039
.possible_values(&["exec", "single", "eval"])
4140
.takes_value(true),
4241
)
4342
.arg(
44-
Arg::with_name("no_expand")
43+
Arg::new("no_expand")
4544
.help(
4645
"Don't expand CodeObject LoadConst instructions to show \
4746
the instructions inside",
4847
)
4948
.long("no-expand")
50-
.short("x"),
49+
.short('x'),
5150
)
5251
.arg(
53-
Arg::with_name("optimize")
52+
Arg::new("optimize")
5453
.help("The amount of optimization to apply to the compiled bytecode")
55-
.short("O")
56-
.multiple(true),
54+
.short('O')
55+
.multiple_occurrences(true),
5756
);
5857
let matches = app.get_matches();
5958

‎examples/parse_folder.rs

Copy file name to clipboardExpand all lines: examples/parse_folder.rs
+9-14Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
/// This an example usage of the rustpython_parser crate.
2-
/// This program crawls over a directory of python files and
3-
/// tries to parse them into an abstract syntax tree (AST)
4-
///
5-
/// example usage:
6-
/// $ RUST_LOG=info cargo run --release parse_folder /usr/lib/python3.7
1+
//! This an example usage of the rustpython_parser crate.
2+
//! This program crawls over a directory of python files and
3+
//! tries to parse them into an abstract syntax tree (AST)
4+
//!
5+
//! example usage:
6+
//! $ RUST_LOG=info cargo run --release parse_folder /usr/lib/python3.7
77
8-
#[macro_use]
98
extern crate clap;
109
extern crate env_logger;
1110
#[macro_use]
@@ -20,14 +19,10 @@ use std::time::{Duration, Instant};
2019
fn main() {
2120
env_logger::init();
2221
let app = App::new("parse_folders")
23-
.version(crate_version!())
24-
.author(crate_authors!())
22+
.version(env!("CARGO_PKG_VERSION"))
23+
.author(env!("CARGO_PKG_AUTHORS"))
2524
.about("Walks over all .py files in a folder, and parses them.")
26-
.arg(
27-
Arg::with_name("folder")
28-
.help("Folder to scan")
29-
.required(true),
30-
);
25+
.arg(Arg::new("folder").help("Folder to scan").required(true));
3126
let matches = app.get_matches();
3227

3328
let folder = Path::new(matches.value_of("folder").unwrap());

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.