taba_cli/tui/effect/mod.rs
1//! What `update` asks the outside world to do (doc 34, section 4). `update` never does it itself: the loop runs the
2//! effects and brings the outcome back as a `Msg`.
3
4use crate::profile::{ConfigFile, Profile};
5use crate::tui::api::ApiCall;
6use crate::tui::i18n::Lang;
7
8#[derive(Debug, Clone, PartialEq, Eq)]
9pub enum Effect {
10 /// Make an API call on a worker; the reply returns with this `id` and `generation`.
11 Call {
12 id: u64,
13 generation: u64,
14 call: ApiCall,
15 },
16 /// Write a file the person chose a path for (never without asking).
17 WriteFile {
18 path: String,
19 contents: String,
20 },
21 /// Keep the language in `ui.language` of the configuration file.
22 SaveLanguage(Lang),
23 /// Write a file that holds a secret, readable only by its owner, never over an existing one.
24 WriteSecret {
25 path: String,
26 contents: String,
27 },
28 /// Ask the terminal to put this text on the clipboard (OSC 52).
29 Copy(String),
30 /// Write the default profile and the profiles to the configuration file.
31 SaveProfiles {
32 file: ConfigFile,
33 select: Option<String>,
34 },
35 /// Try the connection of a profile that may not be saved.
36 CheckProfile(Profile),
37 /// Connect with a profile of the file: from now on the calls go there.
38 Connect(String),
39 Quit,
40}