From daea789c016a2b3ba728e27d3697d22a40fbce47 Mon Sep 17 00:00:00 2001 From: Jay Oster Date: Mon, 10 Apr 2023 16:55:13 -0700 Subject: [PATCH] Prepare 0.1.0 (#2) --- Cargo.lock | 6 +++-- Cargo.toml | 1 + MSRV.md | 1 + examples/derive/Cargo.toml | 2 +- examples/full.rs | 2 +- onlyargs_derive/Cargo.toml | 3 ++- onlyargs_derive/src/lib.rs | 38 ++++++++++++++++---------------- src/lib.rs | 3 ++- src/{extensions.rs => traits.rs} | 0 9 files changed, 31 insertions(+), 25 deletions(-) rename src/{extensions.rs => traits.rs} (100%) diff --git a/Cargo.lock b/Cargo.lock index 1235e80..a71f66a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -21,7 +21,8 @@ checksum = "8070547d90d1b98debb6626421d742c897942bbb78f047694a5eb769495eccd6" [[package]] name = "myn" version = "0.1.0" -source = "git+https://github.com/parasyte/myn.git?rev=c86196dc061a2bea10363c9ed3fb7091a70e3984#c86196dc061a2bea10363c9ed3fb7091a70e3984" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f950af707b8005ae33bb0f0b20cb32b09750e7375085606dc45b2f2078a34e52" [[package]] name = "onlyargs" @@ -41,7 +42,8 @@ dependencies = [ [[package]] name = "onlyerror" version = "0.1.0" -source = "git+https://github.com/parasyte/onlyerror.git?rev=1d25d230767e91a29040b83dbf4faf689e69a818#1d25d230767e91a29040b83dbf4faf689e69a818" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3de62063c9f7ef82b259f3530af425d0b8bba375c7f790087616d8a613b5f8bc" dependencies = [ "myn", ] diff --git a/Cargo.toml b/Cargo.toml index 83b7855..d539b68 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,6 +3,7 @@ name = "onlyargs" description = "Obsessively tiny argument parsing" version = "0.1.0" authors = ["Jay Oster "] +repository = "https://github.com/parasyte/onlyargs" edition = "2021" keywords = ["cli", "arg", "argument", "parse", "parser"] categories = ["command-line-interface"] diff --git a/MSRV.md b/MSRV.md index ff7f3aa..bf33f51 100644 --- a/MSRV.md +++ b/MSRV.md @@ -3,6 +3,7 @@ | `onlyargs` version | `rustc` version | |--------------------|-----------------| | (unreleased) | `1.62.0` | +| `0.1.0` | `1.62.0` | ## Policy diff --git a/examples/derive/Cargo.toml b/examples/derive/Cargo.toml index d3b4cce..0801054 100644 --- a/examples/derive/Cargo.toml +++ b/examples/derive/Cargo.toml @@ -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" diff --git a/examples/full.rs b/examples/full.rs index 1948168..6bc3785 100644 --- a/examples/full.rs +++ b/examples/full.rs @@ -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)] diff --git a/onlyargs_derive/Cargo.toml b/onlyargs_derive/Cargo.toml index f40eb92..d309552 100644 --- a/onlyargs_derive/Cargo.toml +++ b/onlyargs_derive/Cargo.toml @@ -3,6 +3,7 @@ name = "onlyargs_derive" description = "Obsessively tiny argument parsing derive macro" version = "0.1.0" authors = ["Jay Oster "] +repository = "https://github.com/parasyte/onlyargs" edition = "2021" keywords = ["cli", "arg", "argument", "parse", "parser"] categories = ["command-line-interface"] @@ -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 = ".." } diff --git a/onlyargs_derive/src/lib.rs b/onlyargs_derive/src/lib.rs index 2c883c5..3ea5c8b 100644 --- a/onlyargs_derive/src/lib.rs +++ b/onlyargs_derive/src/lib.rs @@ -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 @@ -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` | An optional argument. | -//! | `Vec` | Positional arguments (see below). | +//! | Type | Description | +//! |-------------|-----------------------------------| +//! | `Option` | An optional argument. | +//! | `Vec` | 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`. @@ -303,7 +303,7 @@ pub fn derive_parser(input: TokenStream) -> TokenStream { ); fn parse(args: Vec) -> Result {{ - use ::onlyargs::extensions::*; + use ::onlyargs::traits::*; {flags_vars} {options_vars} diff --git a/src/lib.rs b/src/lib.rs index aa03b25..4506081 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -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)] @@ -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 { diff --git a/src/extensions.rs b/src/traits.rs similarity index 100% rename from src/extensions.rs rename to src/traits.rs