You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Cyril Scetbon (JIRA)" <ji...@apache.org> on 2013/12/18 08:41:09 UTC

[jira] [Comment Edited] (CASSANDRA-6421) Add bash completion to nodetool

    [ https://issues.apache.org/jira/browse/CASSANDRA-6421?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13851480#comment-13851480 ] 

Cyril Scetbon edited comment on CASSANDRA-6421 at 12/18/13 7:40 AM:
--------------------------------------------------------------------

Sorry I didn't see the comment :(

[~lyubent] that's what you should get. I'm on OSX and using bash completion 1.3 from Homebrew :
{code}
$ brew list bash-completion
/usr/local/Cellar/bash-completion/1.3/etc/bash_completion.d/ (180 files)
/usr/local/Cellar/bash-completion/1.3/etc/profile.d/bash_completion.sh
/usr/local/Cellar/bash-completion/1.3/etc/bash_completion
{code}
have is a bash-completion function. Tell me the ./nodetool is not executing the bash completion script :)
To use it, you have to 
- place the file in your bash_completion.d directory (in my case xxxx) :
{code}
$ ls /usr/local/etc/bash_completion.d/node*
/usr/local/etc/bash_completion.d/nodetool
{code}
- add the following (add absolute path if you don't use hombrew) in your ~/.bash_profile :
{code}
if [ -f `brew --prefix`/etc/bash_completion ]; then
    . `brew --prefix`/etc/bash_completion
fi
{code}
- start a new bash session and try :
{code}
nodetool cfh[TAB]
nodetool cfhistograms [TAB][TAB]
pns_fr         system         system_auth    system_traces  test
nodetool cfhistograms system 
HintsColumnFamily      Migrations             batchlog               peer_events            schema_columnfamilies  
IndexInfo              NodeIdInfo             hints                  peers                  schema_columns         
LocationInfo           Schema                 local                  range_xfers            schema_keyspaces
{code}
As you see after cfh has been completed to cfhistograms if you add 2 more \[TAB\] you get the name of keyspaces, and if you add the name of the keyspace system and 2 more \[TAB\] you get names of column families :)
The first word is the nodetool script from cassandra, not the bash completion script 


was (Author: cscetbon):
Sorry I didn't see the comment :(

[~lyubent] that's what you should get. I'm on OSX and using bash completion 1.3 from Homebrew :
{code}
$ brew list bash-completion
/usr/local/Cellar/bash-completion/1.3/etc/bash_completion.d/ (180 files)
/usr/local/Cellar/bash-completion/1.3/etc/profile.d/bash_completion.sh
/usr/local/Cellar/bash-completion/1.3/etc/bash_completion
{code}
have is a bash-completion function. Tell me the ./nodetool is not executing the bash completion script :)
To use it, you have to 
- place the file in your bash_completion.d directory (in my case xxxx) :
{code}
$ ls /usr/local/etc/bash_completion.d/node*
/usr/local/etc/bash_completion.d/nodetool
{code}
- add the following (add absolute path if you don't use hombrew) in your ~/.bash_profile :
{code}
if [ -f `brew --prefix`/etc/bash_completion ]; then
    . `brew --prefix`/etc/bash_completion
fi
{code}
- start a new bash session and try :
{code}
nodetool cfh[TAB]
nodetool cfhistograms [TAB][TAB]
pns_fr         system         system_auth    system_traces  test
nodetool cfhistograms system 
HintsColumnFamily      Migrations             batchlog               peer_events            schema_columnfamilies  
IndexInfo              NodeIdInfo             hints                  peers                  schema_columns         
LocationInfo           Schema                 local                  range_xfers            schema_keyspaces
{code}
As you see after cfh has been completed to cfhistograms if you add 2 more \[TAB\] you get the name of keyspaces, and if you add the name of the keyspace system and 2 mote \[TAB\] you get names of column families :)
The first word is the nodetool script from cassandra, not the bash completion script 

> Add bash completion to nodetool
> -------------------------------
>
>                 Key: CASSANDRA-6421
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-6421
>             Project: Cassandra
>          Issue Type: Improvement
>          Components: Tools
>            Reporter: Cyril Scetbon
>            Assignee: Cyril Scetbon
>            Priority: Trivial
>             Fix For: 2.0.4
>
>
> You can find the patch from my commit here :
> https://github.com/cscetbon/cassandra/commit/07a10b99778f14362ac05c70269c108870555bf3.patch
> it uses cqlsh to get keyspaces and namespaces and could use an environment variable (not implemented) to get access which cqlsh if authentification is needed. But I think that's really a good start :)



--
This message was sent by Atlassian JIRA
(v6.1.4#6159)