Skip to content
This repository has been archived by the owner on Sep 13, 2023. It is now read-only.

Commit

Permalink
Merge pull request #27 from killercup/feature/release-0.1.2
Browse files Browse the repository at this point in the history
Release 0.1.2
  • Loading branch information
killercup authored Jan 28, 2018
2 parents d41e08d + 4d6ae9a commit cb962e8
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "quicli"
version = "0.1.1"
version = "0.1.2"
description = "Quickly build cool CLI apps in Rust."
authors = ["Pascal Hertleif <[email protected]>"]
readme = "Readme.md"
Expand Down
50 changes: 50 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Changelog
All notable changes to this project will be documented in this file.

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

## [Unreleased]

## [0.1.2] - 2018-01-28

### Added

- [A website with guides!](https://killercup.github.io/quicli/)
- `glob`
- `create_dir`
- Re-export Rayon traits
- Export `Result` type alias using failure's Error

## Removed

- All the examples are now guides

## Changed

- `main!` now sets up logging in all cases
- Use buffered reading/writing in fs functions

## [0.1.1] - 2018-01-28

### Added

- Re-export log macros
- Automatically set up env_logger in main!
- `main!` parameter for Cli struct and its logging level field
- Readme fixes
- Expose fs module

## [0.1.0] - 2018-01-28

### Added

- `main!` macro
- Re-exports of failure, serde, structopt
- Commit Message generator example
- read/write file functions

[Unreleased]: https://github.com/killercup/quicli/compare/v1.0.0...HEAD
[0.1.2]: https://github.com/killercup/quicli/compare/v0.1.0...v0.1.2
[0.1.1]: https://github.com/killercup/quicli/compare/v0.1.0...v0.1.1
[0.1.0]: https://github.com/killercup/quicli/compare/cb747195866d2a240ab8154d00facfead3e55a9e...v0.1.0
2 changes: 1 addition & 1 deletion src/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ pub fn write_to_file<P: AsRef<Path>>(path: P, content: &str) -> Result<()> {
/// # fn main() { run().unwrap() }
/// # fn run() -> Result<()> {
/// let markdown_files = glob("*.md")?;
/// assert_eq!(markdown_files.len(), 1);
/// assert_eq!(markdown_files.len(), 2);
///
/// let weird_files = glob("**/*.weird");
/// assert!(weird_files.is_err());
Expand Down
20 changes: 11 additions & 9 deletions src/main_macro.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
/// Quickly get a good `main` function
///
/// Inside the block, you can write code using `?`. An `Ok(())` will
/// automatically be appended.
/// automatically be appended. The macro will also set up logging (using
/// `env_logger`) automatically.
///
/// # Parameters
///
Expand All @@ -11,14 +12,10 @@
/// - `main!(|args: Cli| { ... })`: Automatically parses command line flags into
/// a struct `Cli` and binds it to `args`. (Basically, it prepends
/// `let args = Cli::from_args();`).
/// - `main!(|args: Cli, log_level: verbosity| { ... })`: In addition to parsing
/// the command line flags into `args` of type `Cli`, it will also initialize
/// a logger.
///
/// The log level will depend on the integer value of the `verbosity` field of
/// `args` (error = 0, warn = 1, info = 2, debug = 3, trace = ≥4). The field's
/// type should be `u64`, so structopt will automatically give you its
/// number of occurances.
/// - `main!(|args: Cli, log_level: verbosity| { ... })`: The log level will
/// depend on the integer value of the `verbosity` field of `args` (error = 0,
/// warn = 1, info = 2, debug = 3, trace = ≥4). The field's type should be
/// `u64`, so structopt will automatically give you its number of occurances.
///
/// # Examples
///
Expand Down Expand Up @@ -94,6 +91,11 @@ macro_rules! main {
($body:expr) => {
fn main() {
fn run() -> $crate::prelude::Result<()> {
$crate::prelude::LoggerBuiler::new()
.filter(Some(env!("CARGO_PKG_NAME")), $crate::prelude::LogLevel::Error.to_level_filter())
.filter(None, $crate::prelude::LogLevel::Warn.to_level_filter())
.try_init()?;

$body
Ok(())
}
Expand Down

0 comments on commit cb962e8

Please sign in to comment.