Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v0.3.4 #20

Merged
merged 7 commits into from
Apr 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 5 additions & 26 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,26 +1,5 @@
[package]
name = "promkit"
version = "0.3.3"
authors = ["ynqa <[email protected]>"]
edition = "2021"
description = "A toolkit for building your own interactive command-line tools"
repository = "https://github.com/ynqa/promkit"
license = "MIT"
readme = "README.md"

[lib]
name = "promkit"
path = "src/lib.rs"

[dependencies]
anyhow = "1.0.81"
crossterm = { version = "0.27.0", features = ["use-dev-tty"] }
indexmap = "2.2.3"
radix_trie = "0.2.1"
serde = { version = "1.0.197" }
serde_json = { version = "1.0.114", features = ["preserve_order"] }
thiserror = "1.0.50"
unicode-width = "0.1.8"

[dev-dependencies]
strip-ansi-escapes = "0.2.0"
[workspace]
resolver = "2"
members = [
"promkit",
]
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Put the package in your `Cargo.toml`.

```toml
[dependencies]
promkit = "0.3.3"
promkit = "0.3.4"
```

## Features
Expand Down
26 changes: 26 additions & 0 deletions promkit/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
[package]
name = "promkit"
version = "0.3.4"
authors = ["ynqa <[email protected]>"]
edition = "2021"
description = "A toolkit for building your own interactive command-line tools"
repository = "https://github.com/ynqa/promkit"
license = "MIT"
readme = "README.md"

[lib]
name = "promkit"
path = "src/lib.rs"

[dependencies]
anyhow = "1.0.81"
crossterm = { version = "0.27.0", features = ["use-dev-tty"] }
indexmap = "2.2.3"
radix_trie = "0.2.1"
serde = { version = "1.0.197" }
serde_json = { version = "1.0.114", features = ["preserve_order"] }
thiserror = "1.0.50"
unicode-width = "0.1.8"

[dev-dependencies]
strip-ansi-escapes = "0.2.0"
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 4 additions & 0 deletions src/engine.rs → promkit/src/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ impl<W: Write> Engine<W> {
queue!(self.out, Clear(ClearType::FromCursorDown)).map_err(Error::from)
}

pub fn clear_current_line(&mut self) -> Result {
queue!(self.out, Clear(ClearType::CurrentLine)).map_err(Error::from)
}

/// Writes a string to the terminal.
///
/// # Arguments
Expand Down
File renamed without changes.
File renamed without changes.
6 changes: 6 additions & 0 deletions src/grapheme/styled.rs → promkit/src/grapheme/styled.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,12 @@ impl fmt::Debug for StyledGraphemes {
}
}

impl ToString for StyledGraphemes {
fn to_string(&self) -> String {
self.iter().map(|g| g.ch).collect()
}
}

impl StyledGraphemes {
pub fn from_str<S: AsRef<str>>(string: S, style: ContentStyle) -> Self {
string
Expand Down
File renamed without changes.
26 changes: 13 additions & 13 deletions src/lib.rs → promkit/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,21 @@
//!
//! ```toml
//! [dependencies]
//! promkit = "0.3.3"
//! promkit = "0.3.4"
//! ```
//!
//! ## Features
//!
//! - Support cross-platform both UNIX and Windows owing to [crossterm](https://github.com/crossterm-rs/crossterm)
//! - Various building methods
//! - Preset; Support for quickly setting up a UI by providing simple parameters.
//! - [Readline](https://github.com/ynqa/promkit/tree/v0.3.3#readline)
//! - [Confirm](https://github.com/ynqa/promkit/tree/v0.3.3#confirm)
//! - [Password](https://github.com/ynqa/promkit/tree/v0.3.3#password)
//! - [Select](https://github.com/ynqa/promkit/tree/v0.3.3#select)
//! - [QuerySelect](https://github.com/ynqa/promkit/tree/v0.3.3#queryselect)
//! - [Checkbox](https://github.com/ynqa/promkit/tree/v0.3.3#checkbox)
//! - [Tree](https://github.com/ynqa/promkit/tree/v0.3.3#tree)
//! - [Readline](https://github.com/ynqa/promkit/tree/v0.3.4#readline)
//! - [Confirm](https://github.com/ynqa/promkit/tree/v0.3.4#confirm)
//! - [Password](https://github.com/ynqa/promkit/tree/v0.3.4#password)
//! - [Select](https://github.com/ynqa/promkit/tree/v0.3.4#select)
//! - [QuerySelect](https://github.com/ynqa/promkit/tree/v0.3.4#queryselect)
//! - [Checkbox](https://github.com/ynqa/promkit/tree/v0.3.4#checkbox)
//! - [Tree](https://github.com/ynqa/promkit/tree/v0.3.4#tree)
//! - Combining various UI components.
//! - They are provided with the same interface, allowing users to choose and
//! assemble them according to their preferences.
Expand All @@ -39,7 +39,7 @@
//!
//! ## Examples/Demos
//!
//! See [here](https://github.com/ynqa/promkit/tree/v0.3.2#examplesdemos)
//! See [here](https://github.com/ynqa/promkit/tree/v0.3.4#examplesdemos)
//!
//! ## Why *promkit*?
//!
Expand Down Expand Up @@ -97,10 +97,10 @@ pub use serde_json;

mod core;
pub use core::*;
mod engine;
pub mod engine;
mod error;
pub use error::{Error, Result};
mod grapheme;
pub mod grapheme;
pub mod keymap;
mod macros;
pub mod pane;
Expand Down Expand Up @@ -181,7 +181,7 @@ pub trait AsAny {
/// # Returns
///
/// Returns a `Result` with a `PromptSignal`, indicating the next action for the prompt.
type DynEvaluator = dyn Fn(&Event, &mut Box<dyn Renderer>) -> Result<PromptSignal>;
pub type DynEvaluator = dyn Fn(&Event, &mut Box<dyn Renderer>) -> Result<PromptSignal>;

/// Type alias for a result producer function.
///
Expand All @@ -196,7 +196,7 @@ type DynEvaluator = dyn Fn(&Event, &mut Box<dyn Renderer>) -> Result<PromptSigna
/// # Returns
///
/// Returns a `Result` containing the final output of the prompt.
type ResultProducer<T> = fn(&dyn Renderer) -> Result<T>;
pub type ResultProducer<T> = fn(&dyn Renderer) -> Result<T>;

/// Represents a customizable prompt that can handle user input and produce a result.
///
Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions src/pane.rs → promkit/src/pane.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use crate::grapheme::StyledGraphemes;

#[derive(Clone)]
pub struct Pane {
/// The layout of graphemes within the pane.
/// This vector stores the styled graphemes that make up the content of the pane.
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading