Skip to content

Commit

Permalink
Merge pull request #2 from rustne-kretser/cargo-publish
Browse files Browse the repository at this point in the history
Prepare for publishing on crates.io
  • Loading branch information
eivindbergem authored Mar 14, 2022
2 parents 39d34e7 + 40b7b23 commit 7e55d5f
Show file tree
Hide file tree
Showing 8 changed files with 495 additions and 6 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ jobs:
run: cargo outdated --exit-code 1
- name: Format
run: cargo fmt --all -- --check
- name: Doc
run: cargo doc --verbose --all-features
- name: Build
run: cargo build --verbose --all-features
- name: Run tests
Expand Down
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Changelog
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

## [0.1.0] - 2022-03-14

- Initial release

373 changes: 373 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

73 changes: 73 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
![Pipeline](https://github.com/rustne-kretser/noline/actions/workflows/rust.yml/badge.svg)
[![Crates.io](https://img.shields.io/crates/v/noline.svg)](https://crates.io/crates/noline)
[![API reference](https://docs.rs/noline/badge.svg)](https://docs.rs/noline/)

# noline

Noline is an IO-agnostic `#[no_std]` line editor providing robust
line editing for any system. The core functionality is IO-free, so
it can be adapted to any system be it embedded, async, async
embedded, WASM or IPoAC (IP over Avian Carriers).

Features:
- IO-free
- Minimal dependencies
- No allocation needed - Both heap-based and static buffers are provided
- UTF-8 support
- Emacs keybindings

Possible future features:
- Auto-completion and hints
- Line history

The API should be considered experimental and will change in the
future.


The core consists of a massive state machine taking bytes as input
and returning an iterator over byte slices. There are, however,
some convenience wrappers:
- [`sync::Editor`]
- [`sync::std::IO`]
- [`sync::embedded::IO`]
- [`no_sync::tokio::Editor`]

## Example
```rust
use noline::sync::{std::IO, Editor};
use std::io;
use std::fmt::Write;
use termion::raw::IntoRawMode;

fn main() {
let mut stdin = io::stdin();
let mut stdout = io::stdout().into_raw_mode().unwrap();
let prompt = "> ";

let mut io = IO::new(stdin, stdout);
let mut editor = Editor::<Vec<u8>, _>::new(&mut io).unwrap();

loop {
if let Ok(line) = editor.readline(prompt, &mut io) {
write!(io, "Read: '{}'\n\r", line).unwrap();
} else {
break;
}
}
}
```

For more details, see [docs](https://docs.rs/noline/).

# Usage

Add this to your Cargo.toml:

```toml
[dependencies]
noline = "0.1.0"
```

# License

MPL-2.0
11 changes: 11 additions & 0 deletions noline/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@
name = "noline"
version = "0.1.0"
edition = "2021"
authors = ["Eivind Alexander Bergem <[email protected]>"]
license = "MPL-2.0"
description = "A no_std line editor"
repository = "https://github.com/rustne-kretser/noline"
readme = "../README.md"
categories = ["no-std", "command-line-interface"]
keywords = ["no_std", "readline"]
include = [
"**/*.rs",
"Cargo.toml",
]

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

Expand Down
22 changes: 22 additions & 0 deletions noline/README.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
![Pipeline](https://github.com/rustne-kretser/noline/actions/workflows/rust.yml/badge.svg)
[![Crates.io](https://img.shields.io/crates/v/noline.svg)](https://crates.io/crates/noline)
[![API reference](https://docs.rs/noline/badge.svg)](https://docs.rs/noline/)

# {{crate}}

{{readme}}

For more details, see [docs](https://docs.rs/noline/).

# Usage

Add this to your Cargo.toml:

```toml
[dependencies]
noline = "{{version}}"
```

# License

{{license}}
4 changes: 0 additions & 4 deletions noline/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@
//! - [`sync::embedded::IO`]
//! - [`no_sync::tokio::Editor`]
//!
//! # Feature flags
//!
//! All features are enabled by default
//!
//! # Example
//! ```no_run
//! use noline::sync::{std::IO, Editor};
Expand Down
4 changes: 2 additions & 2 deletions noline/src/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ mod tests {

#[cfg(any(test, feature = "std"))]
pub mod std {
//! IO implementation for `std`
//! IO implementation for `std`. Requires feature `std`.
use super::*;

Expand Down Expand Up @@ -409,7 +409,7 @@ pub mod std {

#[cfg(any(test, feature = "embedded"))]
pub mod embedded {
//! Implementation for embedded systems
//! Implementation for embedded systems. Requires feature `embedded`.
use core::{
fmt,
Expand Down

0 comments on commit 7e55d5f

Please sign in to comment.