pub struct App { /* private fields */ }Implementations§
Source§impl App
impl App
Sourcepub fn add(
context: impl Into<String>,
flake_text: impl Into<String>,
prefill_uri: Option<&str>,
cache_config: CacheConfig,
) -> Self
pub fn add( context: impl Into<String>, flake_text: impl Into<String>, prefill_uri: Option<&str>, cache_config: CacheConfig, ) -> Self
Create a new App for the Add workflow
The workflow asks for URI first, then ID (with inferred ID as default). Optionally provide a prefill_uri if the user provided a URI on the command line.
Sourcepub fn change(
context: impl Into<String>,
flake_text: impl Into<String>,
inputs: Vec<(String, String)>,
cache_config: CacheConfig,
) -> Self
pub fn change( context: impl Into<String>, flake_text: impl Into<String>, inputs: Vec<(String, String)>, cache_config: CacheConfig, ) -> Self
Create a new App for the Change workflow
Takes a list of (id, current_uri) pairs. The current_uri is used to prefill the input field when an item is selected.
Sourcepub fn remove(
context: impl Into<String>,
flake_text: impl Into<String>,
inputs: Vec<String>,
) -> Self
pub fn remove( context: impl Into<String>, flake_text: impl Into<String>, inputs: Vec<String>, ) -> Self
Create a new App for the Remove workflow
Sourcepub fn change_uri(
context: impl Into<String>,
flake_text: impl Into<String>,
id: impl Into<String>,
current_uri: Option<&str>,
show_diff: bool,
cache_config: CacheConfig,
) -> Self
pub fn change_uri( context: impl Into<String>, flake_text: impl Into<String>, id: impl Into<String>, current_uri: Option<&str>, show_diff: bool, cache_config: CacheConfig, ) -> Self
Create a new App for the Change workflow when ID is already known
This is a single-screen variant that just asks for the new URI.
Sourcepub fn select_one(
context: impl Into<String>,
prompt: impl Into<String>,
items: Vec<String>,
initial_diff: bool,
) -> Self
pub fn select_one( context: impl Into<String>, prompt: impl Into<String>, items: Vec<String>, initial_diff: bool, ) -> Self
Create a standalone single-select App (for Pin/Unpin workflows)
Sourcepub fn select_many(
context: impl Into<String>,
prompt: impl Into<String>,
items: Vec<String>,
initial_diff: bool,
) -> Self
pub fn select_many( context: impl Into<String>, prompt: impl Into<String>, items: Vec<String>, initial_diff: bool, ) -> Self
Create a standalone multi-select App (for Update workflow)
Sourcepub fn confirm(context: impl Into<String>, diff: impl Into<String>) -> Self
pub fn confirm(context: impl Into<String>, diff: impl Into<String>) -> Self
Create a standalone confirmation App with pre-computed diff
Sourcepub fn follow(
context: impl Into<String>,
flake_text: impl Into<String>,
nested_inputs: Vec<NestedInput>,
top_level_inputs: Vec<String>,
) -> Self
pub fn follow( context: impl Into<String>, flake_text: impl Into<String>, nested_inputs: Vec<NestedInput>, top_level_inputs: Vec<String>, ) -> Self
Create a new App for the Follow workflow
Shows a list of nested inputs to select from, then a list of targets.
nested_inputs contains the nested input paths with their existing follows info
top_level_inputs are the available targets like “nixpkgs”, “flake-utils”
Sourcepub fn follow_target(
context: impl Into<String>,
flake_text: impl Into<String>,
input: impl Into<String>,
top_level_inputs: Vec<String>,
) -> Self
pub fn follow_target( context: impl Into<String>, flake_text: impl Into<String>, input: impl Into<String>, top_level_inputs: Vec<String>, ) -> Self
Create a new App for the Follow workflow when input is already selected
Shows only the target selection list.
Sourcepub fn from_command(
command: &Command,
flake_text: impl Into<String>,
inputs: Vec<(String, String)>,
diff: bool,
cache_config: CacheConfig,
) -> Option<Self>
pub fn from_command( command: &Command, flake_text: impl Into<String>, inputs: Vec<(String, String)>, diff: bool, cache_config: CacheConfig, ) -> Option<Self>
Create an App from a CLI Command.
This is the main entry point for creating TUI apps from parsed CLI arguments.
Returns None if the command doesn’t need interactive TUI (e.g., all args provided,
or it’s a non-interactive command like List).
§Arguments
command- The parsed CLI commandflake_text- The content of the flake.nix fileinputs- List of (id, uri) pairs representing current inputsdiff- Whether diff mode is enabledcache_config- Cache configuration for completions
pub fn show_diff(&self) -> bool
pub fn screen(&self) -> &Screen
pub fn context(&self) -> &str
Sourcepub fn pending_change(&self) -> Change
pub fn pending_change(&self) -> Change
Get the Change that would be applied based on current workflow state. Useful for testing to verify what modification the TUI would produce.
Sourcepub fn pending_diff(&self) -> String
pub fn pending_diff(&self) -> String
Compute the diff string for the current change against the flake text. Returns the unified diff showing what would change.
This looks at the current screen state (including list selections) to compute a live preview of what would happen.
pub fn update(&mut self, key: KeyEvent) -> UpdateResult
pub fn cursor_position(&self, area: Rect) -> Option<(u16, u16)>
pub fn terminal_height(&self) -> u16
pub fn extract_result(self) -> Option<AppResult>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for App
impl RefUnwindSafe for App
impl Send for App
impl Sync for App
impl Unpin for App
impl UnwindSafe for App
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more