mirror of
https://github.com/clap-rs/clap
synced 2025-03-04 23:37:32 +00:00
refactor(help): Pull out usage separator
This commit is contained in:
parent
b055d3d4c0
commit
6f7174cc7c
1 changed files with 2 additions and 1 deletions
|
@ -14,6 +14,7 @@ use crate::util::FlatSet;
|
||||||
use crate::util::Id;
|
use crate::util::Id;
|
||||||
|
|
||||||
static DEFAULT_SUB_VALUE_NAME: &str = "COMMAND";
|
static DEFAULT_SUB_VALUE_NAME: &str = "COMMAND";
|
||||||
|
const USAGE_SEP: &str = "\n ";
|
||||||
|
|
||||||
pub(crate) struct Usage<'cmd> {
|
pub(crate) struct Usage<'cmd> {
|
||||||
cmd: &'cmd Command,
|
cmd: &'cmd Command,
|
||||||
|
@ -123,7 +124,7 @@ impl<'cmd> Usage<'cmd> {
|
||||||
if self.cmd.is_subcommand_negates_reqs_set()
|
if self.cmd.is_subcommand_negates_reqs_set()
|
||||||
|| self.cmd.is_args_conflicts_with_subcommands_set()
|
|| self.cmd.is_args_conflicts_with_subcommands_set()
|
||||||
{
|
{
|
||||||
let _ = write!(styled, "\n ");
|
let _ = write!(styled, "{}", USAGE_SEP);
|
||||||
if self.cmd.is_args_conflicts_with_subcommands_set() {
|
if self.cmd.is_args_conflicts_with_subcommands_set() {
|
||||||
// Short-circuit full usage creation since no args will be relevant
|
// Short-circuit full usage creation since no args will be relevant
|
||||||
let _ = write!(
|
let _ = write!(
|
||||||
|
|
Loading…
Add table
Reference in a new issue