vela-cli 0.950.0

The Vela command-line tool: inspect, submit, verify, decide, and replay scientific state.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
//! Shared CLI serialization and failure helpers.

use serde::Serialize;

pub(crate) fn fail(message: &str) -> ! {
    crate::ui::fail_with(crate::ui::ErrorKind::Domain, message, None)
}

pub(crate) fn fail_return<T>(message: &str) -> T {
    fail(message)
}

pub(crate) fn print_json<T: Serialize + ?Sized>(value: &T) {
    println!(
        "{}",
        serde_json::to_string_pretty(value).expect("serialize json output")
    );
}