| 1 | //! Complete portable config-policy slice and its production inventory. |
| 2 | //! Remaining config commands are host-owned until their separate adoption. |
| 3 | use codewhale_command_contract::handler::CommandHandler; |
| 4 | use codewhale_command_contract::metadata::{CommandInfo, RegisterCommand}; |
| 5 | use codewhale_command_contract::money; |
| 6 | use codewhale_command_contract::outcome::ConfigPolicyCommandResult as CommandResult; |
| 7 | #[path = "permissions.rs"] |
| 8 | pub mod permissions; |
| 9 | #[path = "policy_messages.rs"] |
| 10 | pub mod policy_messages; |
| 11 | #[path = "status.rs"] |
| 12 | pub mod status; |
| 13 | |
| 14 | pub fn portable_handlers() -> [(&'static CommandInfo, CommandHandler<CommandResult>); 2] { |
| 15 | [ |
| 16 | ( |
| 17 | permissions::PermissionsCmd::info(), |
| 18 | permissions::PermissionsCmd::handler(), |
| 19 | ), |
| 20 | ( |
| 21 | status::StatusCmd::info(), |
| 22 | CommandHandler::Contextual { |
| 23 | capabilities: status::CAPABILITIES, |
| 24 | handler: |contexts, args| { |
| 25 | let result = status::execute(contexts, args); |
| 26 | CommandResult { |
| 27 | message: result.message, |
| 28 | action: result.action.map(|impossible| match impossible {}), |
| 29 | is_error: result.is_error, |
| 30 | } |
| 31 | }, |
| 32 | }, |
| 33 | ), |
| 34 | ] |
| 35 | } |
| 36 | |
| 37 | use codewhale_protocol::display::interpolate; |
| 38 | |
| 39 | #[cfg(test)] |
| 40 | #[path = "policy_tests.rs"] |
| 41 | mod tests; |
| 42 |