mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-27 19:17:43 +00:00
Merge pull request #4444 from papparapa/dirname-move-help-strings-to-md-file
dirname: move help strings to markdown file
This commit is contained in:
commit
4a4dd82ff9
2 changed files with 17 additions and 7 deletions
12
src/uu/dirname/dirname.md
Normal file
12
src/uu/dirname/dirname.md
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
# dirname
|
||||||
|
|
||||||
|
```
|
||||||
|
dirname [OPTION] NAME...
|
||||||
|
```
|
||||||
|
|
||||||
|
Strip last component from file name
|
||||||
|
|
||||||
|
## After Help
|
||||||
|
|
||||||
|
Output each NAME with its last non-slash component and trailing slashes
|
||||||
|
removed; if NAME contains no /'s, output '.' (meaning the current directory).
|
|
@ -9,13 +9,11 @@ use clap::{crate_version, Arg, ArgAction, Command};
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
use uucore::display::print_verbatim;
|
use uucore::display::print_verbatim;
|
||||||
use uucore::error::{UResult, UUsageError};
|
use uucore::error::{UResult, UUsageError};
|
||||||
use uucore::format_usage;
|
use uucore::{format_usage, help_about, help_section, help_usage};
|
||||||
|
|
||||||
const ABOUT: &str = "Strip last component from file name";
|
const ABOUT: &str = help_about!("dirname.md");
|
||||||
const USAGE: &str = "{} [OPTION] NAME...";
|
const USAGE: &str = help_usage!("dirname.md");
|
||||||
const LONG_USAGE: &str = "\
|
const AFTER_HELP: &str = help_section!("after help", "dirname.md");
|
||||||
Output each NAME with its last non-slash component and trailing slashes \n\
|
|
||||||
removed; if NAME contains no /'s, output '.' (meaning the current directory).";
|
|
||||||
|
|
||||||
mod options {
|
mod options {
|
||||||
pub const ZERO: &str = "zero";
|
pub const ZERO: &str = "zero";
|
||||||
|
@ -26,7 +24,7 @@ mod options {
|
||||||
pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
||||||
let args = args.collect_lossy();
|
let args = args.collect_lossy();
|
||||||
|
|
||||||
let matches = uu_app().after_help(LONG_USAGE).try_get_matches_from(args)?;
|
let matches = uu_app().after_help(AFTER_HELP).try_get_matches_from(args)?;
|
||||||
|
|
||||||
let separator = if matches.get_flag(options::ZERO) {
|
let separator = if matches.get_flag(options::ZERO) {
|
||||||
"\0"
|
"\0"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue