Skip to content

Commit

Permalink
Prepare 0.1.0 (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
parasyte authored Apr 10, 2023
1 parent a970715 commit daea789
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 25 deletions.
6 changes: 4 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name = "onlyargs"
description = "Obsessively tiny argument parsing"
version = "0.1.0"
authors = ["Jay Oster <[email protected]>"]
repository = "https://github.com/parasyte/onlyargs"
edition = "2021"
keywords = ["cli", "arg", "argument", "parse", "parser"]
categories = ["command-line-interface"]
Expand Down
1 change: 1 addition & 0 deletions MSRV.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
| `onlyargs` version | `rustc` version |
|--------------------|-----------------|
| (unreleased) | `1.62.0` |
| `0.1.0` | `1.62.0` |

## Policy

Expand Down
2 changes: 1 addition & 1 deletion examples/derive/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ publish = false
error-iter = "0.4"
onlyargs = { path = "../.." }
onlyargs_derive = { path = "../../onlyargs_derive" }
onlyerror = { git = "https://github.com/parasyte/onlyerror.git", rev = "1d25d230767e91a29040b83dbf4faf689e69a818" }
onlyerror = "0.1"
2 changes: 1 addition & 1 deletion examples/full.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use error_iter::ErrorIter as _;
use onlyargs::{extensions::*, CliError, OnlyArgs};
use onlyargs::{traits::*, CliError, OnlyArgs};
use std::{ffi::OsString, path::PathBuf, process::ExitCode};

#[derive(Debug)]
Expand Down
3 changes: 2 additions & 1 deletion onlyargs_derive/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name = "onlyargs_derive"
description = "Obsessively tiny argument parsing derive macro"
version = "0.1.0"
authors = ["Jay Oster <[email protected]>"]
repository = "https://github.com/parasyte/onlyargs"
edition = "2021"
keywords = ["cli", "arg", "argument", "parse", "parser"]
categories = ["command-line-interface"]
Expand All @@ -12,5 +13,5 @@ license = "MIT"
proc-macro = true

[dependencies]
myn = { git = "https://github.com/parasyte/myn.git", rev = "c86196dc061a2bea10363c9ed3fb7091a70e3984" }
myn = "0.1"
onlyargs = { version = "0.1", path = ".." }
38 changes: 19 additions & 19 deletions onlyargs_derive/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
//!
//! # Provided arguments
//!
//! `--help` and `--version` arguments are automatically generated. When the parser encounters
//! `--help|-h` and `--version|-V` arguments are automatically generated. When the parser encounters
//! either, it will print the help or version message and exit the application with exit code 0.
//!
//! # Field attributes
Expand All @@ -33,27 +33,27 @@
//!
//! Here is the list of supported field "primitive" types:
//!
//! | Type | Description |
//! |---------------|--------------------------------------------------|
//! | `bool` | Defines a flag. |
//! | `f32|f64` | Floating point number option. |
//! | `i8|u8` | 8-bit integer option. |
//! | `i16|u16` | 16-bit integer option. |
//! | `i32|u32` | 32-bit integer option. |
//! | `i64|u64` | 64-bit integer option. |
//! | `i128|u128` | 128-bit integer option. |
//! | `isize|usize` | Pointer-sized integer option. |
//! | `OsString` | A string option with platform-specific encoding. |
//! | `PathBuf` | A file system path option. |
//! | `String` | UTF-8 encoded string option. |
//! | Type | Description |
//! |------------------|--------------------------------------------------|
//! | `bool` | Defines a flag. |
//! | `f32`\|`f64` | Floating point number option. |
//! | `i8`\|`u8` | 8-bit integer option. |
//! | `i16`\|`u16` | 16-bit integer option. |
//! | `i32`\|`u32` | 32-bit integer option. |
//! | `i64`\|`u64` | 64-bit integer option. |
//! | `i128`\|`u128` | 128-bit integer option. |
//! | `isize`\|`usize` | Pointer-sized integer option. |
//! | `OsString` | A string option with platform-specific encoding. |
//! | `PathBuf` | A file system path option. |
//! | `String` | UTF-8 encoded string option. |
//!
//! Additionally, some wrapper and composite types are also available, where the type `T` must be
//! one of the primitive types listed above.
//!
//! | Type | Description |
//! |---------------|-----------------------------------|
//! | `Option<T>` | An optional argument. |
//! | `Vec<T>` | Positional arguments (see below). |
//! | Type | Description |
//! |-------------|-----------------------------------|
//! | `Option<T>` | An optional argument. |
//! | `Vec<T>` | Positional arguments (see below). |
//!
//! In argument parsing parlance, "flags" are simple boolean values; the argument does not require
//! a value. For example, the argument `--help`.
Expand Down Expand Up @@ -303,7 +303,7 @@ pub fn derive_parser(input: TokenStream) -> TokenStream {
);
fn parse(args: Vec<std::ffi::OsString>) -> Result<Self, ::onlyargs::CliError> {{
use ::onlyargs::extensions::*;
use ::onlyargs::traits::*;
{flags_vars}
{options_vars}
Expand Down
3 changes: 2 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use std::env;
use std::ffi::OsString;
use std::fmt::Display;

pub mod extensions;
pub mod traits;

/// Argument parsing errors.
#[derive(Debug)]
Expand Down Expand Up @@ -94,6 +94,7 @@ pub trait OnlyArgs {
std::process::exit(0);
}
}

impl Display for CliError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Expand Down
File renamed without changes.

0 comments on commit daea789

Please sign in to comment.