Finding CLI commands in GlassFish is now easier and better

Have you ever stumbled upon what commands to use in asadmin?
Have you ever mistyped a command and the following message is displayed?

Use "help" command for a list of valid commands.
CLI001 Invalid Command, list-component.

And when you execute "asadmin help",  the manpage scrolls down the screen with 200 commands.
Finding the right command is not easy, especially searching through the 200 commands listed in the manpage. 

For those who fall in the above scenario, I have good news to bring to you.
Starting in GlassFish V2 build 26, asadmin will search for the closest matched commands if the command cannot be found.

Let me give you some  examples.
Say that you mistyped "create-domain":

asadmin create-domian  options...

returns:

CLI001 Invalid Command, create-domian.
Closest matched command(s):
    create-domain

Use "help" command for a list of valid commands.

asadmin is able to figure out the command that you're trying to execute is "create-domain", not "create-domian".  

Now, say that you want find the commands associated "jdbc".

On the command prompt, type:

asadmin jdbc

returns all the commands with "jdbc":

CLI001 Invalid Command, jdbc.
Closest matched command(s):
    create-jdbc-connection-pool
    create-jdbc-resource
    delete-jdbc-connection-pool
    delete-jdbc-resource
    list-jdbc-connection-pools
    list-jdbc-resources

Use "help" command for a list of valid commands.

You can even use regular expression to search for the commands.

asadmin "resource$"

returns all the commands that ends with "resource":

CLI001 Invalid Command, resource$.
Closest matched command(s):
    create-connector-resource
    create-custom-resource
    create-javamail-resource
    create-jdbc-resource
    create-jms-resource
    create-jndi-resource
    create-persistence-resource
    delete-connector-resource
    delete-custom-resource
    delete-javamail-resource
    delete-jdbc-resource
    delete-jms-resource
    delete-jndi-resource
    delete-persistence-resource

Use "help" command for a list of valid commands.

You can narrow down the search by adding more regular expressions:

 asadmin "\^create.\*resource$"

returns all the commands that begins with "create"and ends with "resource":

CLI001 Invalid Command, \^create.\*resource$.
Closest matched command(s):
    create-connector-resource
    create-custom-resource
    create-javamail-resource
    create-jdbc-resource
    create-jms-resource
    create-jndi-resource
    create-persistence-resource

Use "help" command for a list of valid commands.

This feature also applies to the "help" command.  When a manpage cannot be found for a command, a list of closest matched commands is displayed.

If you find this feature interesting and want to give it a try, download the latest GlassFish V2. 

Click here... 

<script type="text/javascript" src="http://www.google-analytics.com/urchin.js"> </script> <script type="text/javascript"> _uacct = "UA-1759290-1"; urchinTracker(); </script>
Comments:

Fabulous!

Posted by Kedar Mhaswade on December 01, 2006 at 05:56 AM PST #

This looks awesome Jane! I look forward to trying it out.

Posted by Jennifer Chou on December 01, 2006 at 08:28 AM PST #

Nice feature...now if only those cryptic message ids were replaced by something more readable when the wrong number of arguments is passed to a command....:)

Posted by Hrishikesh Barua on December 01, 2006 at 03:43 PM PST #

very nice idea

Posted by guest on December 03, 2006 at 06:47 PM PST #

Post a Comment:
  • HTML Syntax: NOT allowed
About

janeyoung

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today
News
Blogroll

No bookmarks in folder