[−][src]Struct shelp::Repl
Repl
interacts with the terminal to provide easy interactive shells.
Configuration:
-
leader
What to print as the prompt:> <some-code> ^^- leader
-
continued_leader
If the command is more than one line long, what to print on subsequent lines> <some-code> . <some-code>
-
path
Path to a file to use as persistent history. If given, on construction, the history will be populated from the contents of this file, and will automatically write it to the file on being dropped. In case a path is not specified, the history is lost whenRepl
is dropped. -
capacity
The maximum amount of commands stored in the history. Default capacity is 64. If there are already 64 commands in the history, the oldest one will be forgotten. -
exit_keyword
The keyword to exit the repl, it exits the process, so should not be used if any cleanup is a required before closing repl. Seeset_exit_keyword
-
clear_keyword
Clears the screen. Seeset_clear_keyword
Implementations
impl<L: LangInterface> Repl<L>
[src]
impl Repl<DefaultLangInterface>
[src]
pub fn newd(
leader: &'static str,
continued_leader: &'static str,
path: Option<PathBuf>
) -> Self
[src]
leader: &'static str,
continued_leader: &'static str,
path: Option<PathBuf>
) -> Self
Create a Repl
with default language interface.
pub fn with_capacityd(
leader: &'static str,
continued_leader: &'static str,
capacity: usize,
path: Option<PathBuf>
) -> Self
[src]
leader: &'static str,
continued_leader: &'static str,
capacity: usize,
path: Option<PathBuf>
) -> Self
Create a Repl
with default language interface, and specified history capacity.
impl<L: LangInterface> Repl<L>
[src]
pub fn new(
leader: &'static str,
continued_leader: &'static str,
path: Option<PathBuf>
) -> Self
[src]
leader: &'static str,
continued_leader: &'static str,
path: Option<PathBuf>
) -> Self
Create a Repl
with specified language interface.
pub fn with_capacity(
leader: &'static str,
continued_leader: &'static str,
capacity: usize,
path: Option<PathBuf>
) -> Self
[src]
leader: &'static str,
continued_leader: &'static str,
capacity: usize,
path: Option<PathBuf>
) -> Self
Create a Repl
with specified language interface, and specified history capacity.
pub fn set_exit_keyword(&mut self, exit_keyword: &'static str)
[src]
Sets the exit keyword. If you don't want any exit keyword, set it to an empty string
pub fn set_clear_keyword(&mut self, clear_keyword: &'static str)
[src]
Sets the clear keyword. If you don't want any clear keyword, set it to an empty string
pub fn next(&mut self, colour: Color) -> Result<String>
[src]
The main function, gives the next command
Trait Implementations
Auto Trait Implementations
impl<L = DefaultLangInterface> !RefUnwindSafe for Repl<L>
[src]
impl<L> Send for Repl<L> where
L: Send,
[src]
L: Send,
impl<L = DefaultLangInterface> !Sync for Repl<L>
[src]
impl<L> Unpin for Repl<L> where
L: Unpin,
[src]
L: Unpin,
impl<L> UnwindSafe for Repl<L> where
L: UnwindSafe,
[src]
L: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,