[data/etc/bash_completion.d/sonic-clear] Issue: clear tab completion … #269
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue:
a.) clear tab completion shows garbage value
b.) sonic-clear tab completion does not show correct options
$ clear ^[[3;J^[[H^[[2J
$ sonic-clear
acl-loader crm debug grub insserv psuutil show sonic_installer valgrind
config debconf docker initramfs-tools pfcwd sfputil sonic-clear undebug
Changes :
1.) Have bash_completion function for sonic-clear command instead of clear command.
2.) Use the same completion function for clear[/usr/bin/clear] as well.
3.) Change name of _clear_completion to _sonic_clear_completion.
4.) Replace $1 with "sonic-clear" in _sonic_clear_completion, so that it can be reused for clear.
Signed-off-by: Praveen Chaudhary pchaudhary@linkedin.com
- What I did
Fixed issue: clear tab completion shows garbage value
$ clear TAB-TAB ----> $ clear ^[[3;J^[[H^[[2J
- How I did it
Changes :
1.) Have bash_completion function for sonic-clear command instead of clear command.
2.) Use the same completion function for clear[/usr/bin/clear] as well.
3.) Change name of _clear_completion to _sonic_clear_completion.
4.) Replace $1 with "sonic-clear" in _sonic_clear_completion, so that it can be reused for clear.
- How to verify it
Tests:
1.) clear [Enter]
Clears Screen
2.) clear
$ clear
arp bgp counters fdb ip ipv6
3.) clear a
$ clear a
arp
4.) clear counters
$ clear counters
Permission Denied, Please run as root/sudo
5.) clear arp
$ clear arp
fe80::2a6f:7fff:feba:1cff dev eth0 lladdr 28:6f:7f:ba:1c:ff router used 259/319/70 probes 0 STALE
172.25.11.1 dev eth0 lladdr 28:6f:7f:ba:1c:ff ref 1 used 66/0/65 probes 1 REACHABLE
Round 1, deleting 2 entries
Flush is complete after 1 round
6.) $ sonic-clear
arp bgp counters fdb ip ipv6
7.) which clear
/usr/local/bin/clear
- Previous command output (if the output of a command-line utility has changed)
$ clear ^[[3;J^[[H^[[2J
$ sonic-clear
acl-loader crm debug grub insserv psuutil show sonic_installer valgrind
config debconf docker initramfs-tools pfcwd sfputil sonic-clear undebug
- New command output (if the output of a command-line utility has changed)
As per section 3.
-->