1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
use crate::prelude::*;

#[derive(Debug, Serialize)]
#[non_exhaustive]
#[must_use = include_doc!(must_use_cmd_output)]
pub enum LaunchOutput {
	#[doc = include_doc!(cmd_error)]
	ErrorUnImplemented(String),

	#[doc = include_doc!(cmd_success)]
	SuccessUnImplemented(String),
}

impl CommandNomParsable for LaunchOutput {
	fn success_unimplemented(str: String) -> Self {
		Self::SuccessUnImplemented(str)
	}

	fn error_unimplemented(str: String) -> Self {
		Self::ErrorUnImplemented(str)
	}
}

impl PublicCommandOutput for LaunchOutput {
	type PrimarySuccess = ();

	fn success(&self) -> Result<&Self::PrimarySuccess> {
		match self {
			LaunchOutput::SuccessUnImplemented(_) => Ok(&()),
			LaunchOutput::ErrorUnImplemented(_) => Err(Error::output_errored(self)),
		}
	}
}