Skip to main content

start_command/
mod.rs

1//! start-command library
2//!
3//! Provides command execution with isolation, substitution, and failure handling.
4
5pub mod args_parser;
6pub mod args_parser_queries;
7pub(crate) mod docker_cleanup;
8mod docker_network_lifecycle;
9pub mod execution_attach;
10pub mod execution_control;
11pub mod execution_resume;
12pub mod execution_resume_all;
13pub mod execution_store;
14pub mod exit_reason;
15pub mod failure_handler;
16pub mod isolation;
17pub mod isolation_metadata;
18pub mod log_uploader;
19pub mod output_blocks;
20pub mod query_commands;
21pub mod sequence_parser;
22pub mod session_probe;
23pub mod signal_handler;
24pub mod status_formatter;
25pub mod substitution;
26pub mod usage;
27pub mod user_manager;
28
29mod lino_value_json;
30mod local_hostname;
31
32// Re-export commonly used items
33pub use args_parser::{
34    generate_session_name, generate_uuid, get_effective_mode, has_isolation, is_valid_uuid,
35    parse_args, validate_options, ParsedArgs, WrapperOptions, VALID_BACKENDS, VALID_OUTPUT_FORMATS,
36    VALID_SHELLS,
37};
38pub use execution_attach::{
39    attach_execution, attach_execution_with_runners, build_attach_plan,
40    format_attach_result_as_links_notation, AttachPlan, AttachResultFields, ExecutionAttachResult,
41    InteractiveRunner, SystemInteractiveRunner,
42};
43pub use execution_control::{
44    collect_descendant_pids, collect_descendant_pids_with_runner, collect_process_ids,
45    collect_process_ids_with_runner, control_execution, control_execution_with_runner,
46    format_control_result_as_links_notation, get_control_command, parse_screen_pid,
47    CommandRunOutput, CommandRunner, ControlAction, ControlCommand, ExecutionControlResult,
48    SystemCommandRunner,
49};
50pub use execution_resume::{
51    build_resume_plan, build_resumed_session_name, build_snapshot_image_name, resume_execution,
52    resume_execution_with, ExecutionResumeResult, ResumeHooks, ResumeMode, ResumePlan,
53    ResumeResultFields, SystemResumeHooks,
54};
55pub use execution_resume_all::{
56    format_resume_all, resume_all_executions, resume_all_executions_with, ExecutionResumeAllResult,
57    ResumeAllAction, ResumeAllEntry,
58};
59pub use execution_store::{
60    is_clink_installed, CleanupOptions, CleanupResult, ExecutionRecord, ExecutionRecordOptions,
61    ExecutionStats, ExecutionStatus, ExecutionStore, ExecutionStoreOptions,
62};
63pub use exit_reason::{detect_exit_reason, resolve_exit_reason, signal_name_for_exit_code};
64pub use failure_handler::{handle_failure, Config as FailureConfig};
65pub use isolation::{
66    append_log_file, build_command_string, build_command_string_with, build_display_command,
67    build_shell_with_args_cmd_args, command_name, create_log_footer, create_log_header,
68    create_log_path, create_log_path_for_execution, docker_image_exists, docker_pull_image,
69    get_default_docker_image, get_timestamp, is_command_available, is_interactive_shell_command,
70    is_shell_invocation_with_args, quote_shell_arg, quote_shell_arg_with, run_as_isolated_user,
71    run_isolated, split_shell_words, split_shell_words_with, to_shell_words, write_log_file,
72    IsolationOptions, IsolationResult, LogHeaderParams, ShellQuotingStyle,
73};
74pub use isolation_metadata::{
75    build_isolation_options_map, docker_runtime_metadata, docker_runtime_status_lines,
76    docker_runtime_status_lines_for_options,
77};
78pub use log_uploader::upload_execution_log;
79#[allow(deprecated)]
80pub use output_blocks::{
81    // Timeline format API (formerly "status spine")
82    create_command_line,
83    create_empty_spine_line, // deprecated, use create_empty_timeline_line
84    create_empty_timeline_line,
85    create_finish_block,
86    create_spine_line, // deprecated, use create_timeline_line
87    create_start_block,
88    create_timeline_line,
89    create_timeline_separator,
90    create_virtual_command_block,
91    create_virtual_command_result,
92    escape_for_links_notation,
93    format_duration,
94    format_value_for_links_notation,
95    generate_isolation_lines,
96    get_result_marker,
97    parse_isolation_metadata,
98    FinishBlockOptions,
99    IsolationMetadata,
100    StartBlockOptions,
101    FAILURE_MARKER,
102    SPINE, // deprecated, use TIMELINE_MARKER
103    SUCCESS_MARKER,
104    TIMELINE_MARKER,
105};
106pub use query_commands::{dispatch_query_command, handle_cleanup, report_result, QueryOutcome};
107pub use session_probe::{probe_session, SessionProbe, SessionState};
108pub use signal_handler::{
109    clear_current_execution, get_signal_exit_code, set_current_execution, setup_signal_handlers,
110    was_signal_received,
111};
112pub use status_formatter::{
113    attach_current_time, enrich_detached_status, format_record, format_record_as_links_notation,
114    format_record_as_links_notation_with_current_time, format_record_as_text,
115    format_record_as_text_with_current_time, format_record_list,
116    format_record_list_as_links_notation, format_record_list_as_text,
117    format_record_with_current_time, is_detached_session_alive, list_executions,
118    list_executions_filtered, query_status, read_exit_code_from_log, StatusQueryResult,
119};
120pub use substitution::{process_command, ProcessOptions, SubstitutionResult};
121pub use usage::print_usage;
122pub use user_manager::{
123    create_isolated_user, delete_user, get_current_user, get_current_user_groups, has_sudo_access,
124    CreateIsolatedUserOptions, DeleteUserOptions, UserOperationResult,
125};