mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-11-24 09:24:26 +03:00
make test output stuff clickable inside urxvt
This commit is contained in:
parent
5fbd5e1546
commit
b260de1d50
18
clickable_links.py
Executable file
18
clickable_links.py
Executable file
@ -0,0 +1,18 @@
|
||||
#!/usr/bin/python
|
||||
#
|
||||
# Put this in your ~/.Xdefaults:
|
||||
#
|
||||
# URxvt.perl-ext-common: default,matcher
|
||||
# URxvt.url-launcher: /home/dabreegster/abstreet/clickable_links.py
|
||||
# URxvt.matcher.button: 1
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
arg = sys.argv[1]
|
||||
if arg.startswith('http://most/'):
|
||||
os.execvp('gedit', ['gedit', arg[len('http://most/'):]])
|
||||
elif arg.startswith('http://ui/'):
|
||||
os.execvp('urxvt', ['urxvt', '-e', 'sh', '-c', 'cd ~/abstreet/editor; cargo run ' + arg[len('http://ui/'):]])
|
||||
else:
|
||||
os.execvp('xdg-open', ['xdg-open', arg])
|
@ -5,6 +5,7 @@ release_mode=""
|
||||
filter=""
|
||||
test_names=""
|
||||
keep_output=""
|
||||
clickable_links="--clickable_links"
|
||||
|
||||
for arg in "$@"; do
|
||||
if [ "$arg" == "--release" ]; then
|
||||
@ -15,10 +16,12 @@ for arg in "$@"; do
|
||||
filter="--filter=Slow";
|
||||
elif [ "$arg" == "--keep_output" ]; then
|
||||
filter="--keep_output";
|
||||
elif [ "$arg" == "--noclickable_links" ]; then
|
||||
clickable_links="";
|
||||
else
|
||||
test_names="--test_names=$arg";
|
||||
fi
|
||||
done
|
||||
|
||||
cd tests;
|
||||
RUST_BACKTRACE=1 cargo run $release_mode -- $filter $keep_output $test_names
|
||||
RUST_BACKTRACE=1 cargo run $release_mode -- $filter $keep_output $clickable_links $test_names
|
||||
|
@ -23,6 +23,10 @@ pub struct Flags {
|
||||
/// Keep the log and savestate even for passing tests.
|
||||
#[structopt(long = "keep_output")]
|
||||
keep_output: bool,
|
||||
|
||||
/// Print debug output as clickable HTTP links.
|
||||
#[structopt(long = "clickable_links")]
|
||||
clickable_links: bool,
|
||||
}
|
||||
|
||||
pub struct TestRunner {
|
||||
@ -58,12 +62,24 @@ impl TestResult {
|
||||
);
|
||||
}
|
||||
if !self.pass || flags.keep_output {
|
||||
if flags.clickable_links {
|
||||
println!(
|
||||
" {}",
|
||||
Paint::cyan(&format!("http://most/{}", self.output_path))
|
||||
);
|
||||
} else {
|
||||
println!(" {}", Paint::cyan(&self.output_path));
|
||||
}
|
||||
|
||||
if let Some(ref path) = self.debug_with_savestate {
|
||||
if flags.clickable_links {
|
||||
println!(" {}", Paint::yellow(format!("http://ui/{}", path)));
|
||||
} else {
|
||||
println!(" {}", Paint::yellow(path));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl TestRunner {
|
||||
|
Loading…
Reference in New Issue
Block a user