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

docs: update README.md #34

Merged
merged 1 commit into from
Apr 19, 2023
Merged
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
23 changes: 15 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
<p>Command line interface as a function.</p>
<h1>fncmd</h1>

[![Crates.io](https://img.shields.io/crates/v/fncmd)](https://crates.io/crates/fncmd)
[![crates.io](https://img.shields.io/crates/v/fncmd)](https://crates.io/crates/fncmd)
[![docs.rs](https://img.shields.io/docsrs/fncmd)](https://docs.rs/fncmd/latest/fncmd/)
[![License](https://img.shields.io/github/license/yuhr/fncmd)](https://github.com/yuhr/fncmd/blob/develop/LICENSE)

<br><br></div>
Expand All @@ -20,7 +21,7 @@ This concept is tremendously inspired by [`argopt`](https://crates.io/crates/arg

**This crate is nightly-only**. Make sure you have set up your toolchain as nightly before using (e.g. having [`rust-toolchain`](https://rust-lang.github.io/rustup/overrides.html#the-toolchain-file) file). You might be interested in [Why nightly](#why-nightly).

To install, run:
To install, run in your project directory:

```sh
cargo add fncmd
Expand Down Expand Up @@ -131,7 +132,7 @@ another-orphan
└── another-orphan sub
```

Looking at `another-orphan`, it's not contained within `another`, because it's not exposed as `pub`. As seen here, making the `main` of a target non-`pub` is only meaningful when you want it to have a common prefix with others but not to be included by another command, so in most cases you can set `pub` without thinking.
Note that `another-orphan` is not contained within `another`, because it's not exposed as `pub`. As seen here, making the `main` of a target non-`pub` is only meaningful when you want it to have a common prefix with others but not to be included by another command, so in most cases you can set `pub` without thinking.

Of course the same structure can be achieved without manually editing `Cargo.toml`, by placing files into the default location:

Expand Down Expand Up @@ -176,13 +177,19 @@ Position of the doc comment doesn't matter.

## Restrictions

`fncmd` won't support following features by design:
`fncmd` won't support following features by design. That's why `fncmd` states “opinionated”.

- Show authors on the help message
- Change the name and the version of the command to arbitrary values
- Attach `#[fncmd]` to functions other than `main`
### Can't show authors in the help message

That's why `fncmd` states “opinionated”. Showing authors on the help will simply be a noise from general user's point of view, and changing metadata such as `name` and `version` to different values from the ones defined in `Cargo.toml` can easily undermine maintainability and consistency of them. Attaching `#[fncmd]` to arbitrary functions can lead to a bloated single file codebase, which should be avoided in general.
Showing authors in the help will simply be a noise from general user's point of view.

### Can't change the name and the version of the commands to different values

Changing metadata such as `name` and `version` to different values from the ones defined in `Cargo.toml` can easily undermine maintainability and consistency of them.

### Can't attach `#[fncmd]` to functions other than `main`

Attaching `#[fncmd]` to arbitrary functions can lead to a bloated single file codebase, which should be avoided in general.

## Why nightly

Expand Down