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 0a6156b

Browse filesBrowse files
committed
Use lexopt for argument parsing
1 parent 8484bfa commit 0a6156b
Copy full SHA for 0a6156b

File tree

Expand file treeCollapse file tree

6 files changed

+282
-330
lines changed
Filter options
Expand file treeCollapse file tree

6 files changed

+282
-330
lines changed

‎Cargo.lock

Copy file name to clipboardExpand all lines: Cargo.lock
+7-26Lines changed: 7 additions & 26 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
@@ -34,7 +34,7 @@ cfg-if = { workspace = true }
3434
log = { workspace = true }
3535
flame = { workspace = true, optional = true }
3636

37-
clap = "2.34"
37+
lexopt = "0.3"
3838
dirs = { package = "dirs-next", version = "2.0.0" }
3939
env_logger = { version = "0.9.0", default-features = false, features = ["atty", "termcolor"] }
4040
flamescope = { version = "0.1.2", optional = true }

‎Lib/test/test_cmd_line.py

Copy file name to clipboardExpand all lines: Lib/test/test_cmd_line.py
-8Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@ def verify_valid_flag(self, cmd_line):
3838
self.assertNotIn(b'Traceback', err)
3939
return out
4040

41-
# TODO: RUSTPYTHON
42-
@unittest.expectedFailure
4341
def test_help(self):
4442
self.verify_valid_flag('-h')
4543
self.verify_valid_flag('-?')
@@ -82,8 +80,6 @@ def test_optimize(self):
8280
def test_site_flag(self):
8381
self.verify_valid_flag('-S')
8482

85-
# NOTE: RUSTPYTHON version never starts with Python
86-
@unittest.expectedFailure
8783
def test_version(self):
8884
version = ('Python %d.%d' % sys.version_info[:2]).encode("ascii")
8985
for switch in '-V', '--version', '-VV':
@@ -550,8 +546,6 @@ def test_no_stderr(self):
550546
def test_no_std_streams(self):
551547
self._test_no_stdio(['stdin', 'stdout', 'stderr'])
552548

553-
# TODO: RUSTPYTHON
554-
@unittest.expectedFailure
555549
def test_hash_randomization(self):
556550
# Verify that -R enables hash randomization:
557551
self.verify_valid_flag('-R')
@@ -966,8 +960,6 @@ def test_ignore_PYTHONPATH(self):
966960
self.run_ignoring_vars("'{}' not in sys.path".format(path),
967961
PYTHONPATH=path)
968962

969-
# TODO: RUSTPYTHON
970-
@unittest.expectedFailure
971963
def test_ignore_PYTHONHASHSEED(self):
972964
self.run_ignoring_vars("sys.flags.hash_randomization == 1",
973965
PYTHONHASHSEED="0")

‎src/lib.rs

Copy file name to clipboardExpand all lines: src/lib.rs
+7-4Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,6 @@
3737
//! it will have your modules loaded into the vm.
3838
#![allow(clippy::needless_doctest_main)]
3939

40-
#[macro_use]
41-
extern crate clap;
42-
extern crate env_logger;
4340
#[macro_use]
4441
extern crate log;
4542

@@ -73,7 +70,13 @@ pub fn run(init: impl FnOnce(&mut VirtualMachine) + 'static) -> ExitCode {
7370
};
7471
}
7572

76-
let (settings, run_mode) = opts_with_clap();
73+
let (settings, run_mode) = match opts_with_clap() {
74+
Ok(x) => x,
75+
Err(e) => {
76+
println!("{e}");
77+
return ExitCode::FAILURE;
78+
}
79+
};
7780

7881
// don't translate newlines (\r\n <=> \n)
7982
#[cfg(windows)]

0 commit comments

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