netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yedaya Katsman <yedaya.ka@gmail.com>
To: netdev@vger.kernel.org
Cc: Stephen Hemminger <stephen@networkplumber.org>,
	Yedaya Katsman <yedaya.ka@gmail.com>
Subject: [PATCH] ip: Add examples to usage help
Date: Sun, 11 Feb 2024 19:57:04 +0200	[thread overview]
Message-ID: <20240211175704.5963-1-yedaya.ka@gmail.com> (raw)

Currently the usage only shows the syntax with all possible options,
which makes writing the most frequently used commands cumbersome, since it
requires parsing the syntax in your head. This praticularly affects
users new to the command, that resort to reading man pages or search
engines in order to find the correct invocations.

Copy over the examples from the man page, with the same indentation
for the command exaplanations that exist there. I removed the second
link example to save space.

The whole section is indented the same way the other sections in the usage
are, to keep the uniformity.

Signed-off-by: Yedaya Katsman <yedaya.ka@gmail.com>
---
 ip/ip.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/ip/ip.c b/ip/ip.c
index e51fa206d282..78c3f130c593 100644
--- a/ip/ip.c
+++ b/ip/ip.c
@@ -73,7 +73,16 @@ static void usage(void)
 		"                    -l[oops] { maximum-addr-flush-attempts } | -echo | -br[ief] |\n"
 		"                    -o[neline] | -t[imestamp] | -ts[hort] | -b[atch] [filename] |\n"
 		"                    -rc[vbuf] [size] | -n[etns] name | -N[umeric] | -a[ll] |\n"
-		"                    -c[olor]}\n");
+		"                    -c[olor]}\n"
+		"Examples: ip addr\n"
+		"              Shows addresses assigned to all network interfaces.\n"
+		"          ip neigh\n"
+		"              Shows the current neighbour table in kernel.\n"
+		"          ip link set x up\n"
+		"              Bring up interface x.\n"
+		"          ip route\n"
+		"              Show table routes.\n"
+		);
 	exit(-1);
 }
 
-- 
2.34.1


             reply	other threads:[~2024-02-11 17:57 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-11 17:57 Yedaya Katsman [this message]
2024-02-11 21:00 ` [PATCH] ip: Add examples to usage help Stephen Hemminger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240211175704.5963-1-yedaya.ka@gmail.com \
    --to=yedaya.ka@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=stephen@networkplumber.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).