All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Schmidt <s.schmidt@samsung.com>
To: 'Alexander Aring' <alex.aring@gmail.com>
Cc: linux-wpan@vger.kernel.org
Subject: Re: [PATCH wpan-tools 1/2] treewide: shorten commands
Date: Tue, 20 Jan 2015 14:43:53 +0000	[thread overview]
Message-ID: <009901d034bf$836e82c0$8a4b8840$@samsung.com> (raw)
In-Reply-To: <20150120113231.GA3922@omega>

Hello.

On 20/01/15 12:32, Alexander Aring wrote:
> On Tue, Jan 20, 2015 at 11:05:26AM +0000, Stefan Schmidt wrote:
>> Hello.
>>
>> On 20/01/15 11:35, Alexander Aring wrote:
>>> This patch shorten all commands. I had the idea to make a similarity
>> >from PIB/MIB values according the 802.15.4 names convention but this is
>>> bad for fast shell hacking. Mainly I remove the underscore and some
>>> additional information which are not necessary like "_addr" in
>>> "short_addr" and "extended_addr" and such things.
>>>
>>> Signed-off-by: Alexander Aring <alex.aring@gmail.com>
>>> ---
>>>   src/info.c      | 10 +++++-----
>>>   src/interface.c | 20 ++++++++++----------
>>>   src/mac.c       | 10 +++++-----
>>>   src/phy.c       |  6 +++---
>>>   4 files changed, 23 insertions(+), 23 deletions(-)
>>
>> Hmm, it feels like you are going overboard with shorting things here. Why
>> is
>> the reason behind it? Just less typing? Shell auto completion would handle
>> this. :)
>>
>
> it's just less typing and I notice that the original iw command doesn't
> have an underscore in their commands.
>
> The first time when I hacked it, then I just took the same naming
> convention in kernel implementation which use the naming convention from
> 802.15.4 standard (without the beginning "MAC" and "PHY" keywords).

Having the naming the same in specs, kernel and the config util is 
actually good thing. This helps newcomers to understand them more easily.

> Now I am too lazy to always type pan_id short_addr, etc...

If the primary goal would be less typing the the binary should be named 
"i" and the options a, b, c, d :)

> Do you like to implement some completion stuff which can be shipped out
> optionally with the wpan-tools? :-)

Here is a start:
_iwpan()
{
     local cur prev opts
     COMPREPLY=()
     cur="${COMP_WORDS[COMP_CWORD]}"
     prev="${COMP_WORDS[COMP_CWORD-1]}"
     opts="--debug --version phy dev set channel tx_power cca_mode 
cca_ed_level pan_id short_addr max_frame_retries backoff_exponents 
max_csma_backoffs lbt info list interface add"

     COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
     return 0
}
complete -F _iwpan iwpan

Just drop this in a file called iwpan in  /etc/bash_completion.d/ and a 
simple command completion would work with bash. zsh user might want to 
do their own.

This has no fancy things like completing available wpan interfaces, etc 
but it completes all commands which was what you complained about for 
typing. :)

regards
Stefan Schmidt



      parent reply	other threads:[~2015-01-20 14:44 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-20 10:35 [PATCH wpan-tools 1/2] treewide: shorten commands Alexander Aring
2015-01-20 10:35 ` [PATCH wpan-tools 2/2] interface: remove twice phy information Alexander Aring
2015-01-20 11:05 ` [PATCH wpan-tools 1/2] treewide: shorten commands Stefan Schmidt
2015-01-20 11:32   ` Alexander Aring
2015-01-20 11:47     ` Alexander Aring
2015-01-20 14:43     ` Stefan Schmidt [this message]

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='009901d034bf$836e82c0$8a4b8840$@samsung.com' \
    --to=s.schmidt@samsung.com \
    --cc=alex.aring@gmail.com \
    --cc=linux-wpan@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.