mirror of
https://github.com/asciinema/asciinema.git
synced 2025-12-15 19:28:00 +01:00
Warn when no outputs enabled for session command
This commit is contained in:
@@ -113,10 +113,6 @@ impl cli::Session {
|
||||
status::info!("Live streaming at {}", url);
|
||||
}
|
||||
|
||||
if command.is_none() {
|
||||
status::info!("Press <ctrl+d> or type 'exit' to end");
|
||||
}
|
||||
|
||||
let stream = Stream::new();
|
||||
let shutdown_token = CancellationToken::new();
|
||||
|
||||
@@ -148,6 +144,14 @@ impl cli::Session {
|
||||
outputs.push(Box::new(output));
|
||||
}
|
||||
|
||||
if outputs.is_empty() {
|
||||
status::warning!("No outputs enabled, consider using -o, -s, or -r");
|
||||
}
|
||||
|
||||
if command.is_none() {
|
||||
status::info!("Press <ctrl+d> or type 'exit' to end");
|
||||
}
|
||||
|
||||
let exec_command = build_exec_command(command.as_ref().cloned());
|
||||
let exec_extra_env = build_exec_extra_env(relay_id.as_ref());
|
||||
|
||||
|
||||
@@ -6,14 +6,26 @@ pub fn disable() {
|
||||
}
|
||||
|
||||
macro_rules! info {
|
||||
($fmt:expr) => (crate::status::println(format!($fmt)));
|
||||
($fmt:expr, $($arg:tt)*) => (crate::status::println(format!($fmt, $($arg)*)));
|
||||
($fmt:expr) => (crate::status::do_info(format!($fmt)));
|
||||
($fmt:expr, $($arg:tt)*) => (crate::status::do_info(format!($fmt, $($arg)*)));
|
||||
}
|
||||
|
||||
pub fn println(message: String) {
|
||||
macro_rules! warning {
|
||||
($fmt:expr) => (crate::status::do_warn(format!($fmt)));
|
||||
($fmt:expr, $($arg:tt)*) => (crate::status::do_warn(format!($fmt, $($arg)*)));
|
||||
}
|
||||
|
||||
pub fn do_info(message: String) {
|
||||
if ENABLED.load(SeqCst) {
|
||||
println!("::: {message}");
|
||||
}
|
||||
}
|
||||
|
||||
pub fn do_warn(message: String) {
|
||||
if ENABLED.load(SeqCst) {
|
||||
println!("!!! {message}");
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) use info;
|
||||
pub(crate) use warning;
|
||||
|
||||
Reference in New Issue
Block a user