Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "Eclipse b3/cli"

(New page: Category:Eclipse b3)
 
(Running a script)
 
(13 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 +
=UNDER CONSTRUCTION=
 +
This documentation is under construction. Current content may be used as hints.
 +
 +
=b3 Command Line Interface=
 +
The b3 Command Line Interface (CLI) is a generic light weight command line oriented user interface to an extensible set of headless actions.
 +
 +
==Headless installation==
 +
The following steps focus on the installation of the bare b3 command line interface.
 +
 +
#Start by '''Downloading the (headless) director''' which can be found [http://www.eclipse.org/downloads/download.php?file=/tools/buckminster/products/director_latest.zip here].
 +
#Next '''unpack the director''' to a location of your choice. You may want to set the <code>PATH</code> to include the install location and make the director accessible for additional use.
 +
#'''Install b3''' with the following command:
 +
#*<code>director -r <HEADLESS_REPO> -d <INSTALL_DIR> -p b3 -i org.eclipse.b3.cli.product</code> where
 +
#**'''''-r <HEADLESS_REPO>''''' is the headless p2 update site: Current version is: http://download.eclipse.org/modeling/emft/b3/headless-3.6 (Check the download page for changes of the headless update site.)
 +
#**'''''-d <INSTALL_DIR>''''' is the chosen install location of the headless b3
 +
#**'''''-p b3''''' is the name of the p2 profile
 +
#**'''''-i org.eclipse.cli.product''''' is the name of the headless b3 base
 +
 +
==Launch headless b3==
 +
# run "b3" script in the directory where b3 is installed with previous step
 +
# if no extension is installed, only ''--stackTrace'' and ''-?'' resp. ''--help'' options and ''runScript'' command are available:
 +
<pre>
 +
No command was specified
 +
 +
Usage: b3 command [options...]
 +
--eclipseLogLevel [DEBUG | INFO |      : Controls the verbosity of the eclipse
 +
WARNING | ERROR]                      : log trace output. Defaults to global
 +
                                          b3 settings.
 +
--logLevel [DEBUG | INFO | WARNING |  : Controls the verbosity of the console
 +
ERROR]                                : trace output. Defaults to global b3
 +
                                          settings.
 +
--stacktrace                          : Display stack trace on error
 +
-? (--help)                            : Print help screen for specified
 +
                                          command
 +
 +
Available commands:
 +
runScript - Runs a set of commands from a script file
 +
</pre>
 +
 +
==Running a script==
 +
A script file can be run with b3 command line interface. The script file can contain any valid b3 commands with arguments. Nesting of the script files is allowed, but be careful to avoid endless script loop.
 +
 +
Usage: b3 runScript [options...] <script file>
 +
--eclipseLogLevel [DEBUG | INFO |      : Controls the verbosity of the eclipse
 +
WARNING | ERROR]                      : log trace output. Defaults to global
 +
                                          b3 settings.
 +
--logLevel [DEBUG | INFO | WARNING |  : Controls the verbosity of the console
 +
ERROR]                                : trace output. Defaults to global b3
 +
                                          settings.
 +
--stacktrace                          : Display stack trace on error
 +
-? (--help)                            : Print help screen for specified
 +
                                          command
 +
-c (--continueonerror)                : If this flag is set, script execution
 +
                                          will continue after a command fails.
 +
 +
===More information===
 +
Commands defined in the script file are launched sequentially. The following rules apply:
 +
* each command is defined on a single line
 +
* parameters may be enclosed in quotes or double quotes
 +
* parameters may contain variables ${var}, $var or $env:var, ${env.var}
 +
* variables are expanded only if parameters are double quoted
 +
* parameters may contain escaped characters
 +
* \t, \r and \n are replaced with tab, return or new line
 +
* empty lines and lines beginning with '#' are comments
 +
 +
==Adding extensions==
 +
# use p2 director to install new features that may contribute new commands
 +
# running b3 CLI with extensions prints a usage screen with all available commands
 +
# running b3 CLI with specified command prints a usage screen with all available options for that command
 +
 +
==Writing a new extension==
 +
# create a new bundle
 +
# create a class extending org.eclipse.b3.cli.AbstractCommand
 +
# define class fields with ''org.kohsuke.args4j.Option'' or ''org.kohsuke.args4j.Argument'' annotations (see args4j manual for more details)
 +
# implement ''run(IProgressMonitor monitor)'' method
 +
# register an extension for ''org.eclipse.b3.cli.commands'' (specify implementing class and command name)
 +
# add the bundle to your b3 configuration
 +
 +
 
[[Category:Eclipse b3]]
 
[[Category:Eclipse b3]]

Latest revision as of 11:55, 2 June 2010

UNDER CONSTRUCTION

This documentation is under construction. Current content may be used as hints.

b3 Command Line Interface

The b3 Command Line Interface (CLI) is a generic light weight command line oriented user interface to an extensible set of headless actions.

Headless installation

The following steps focus on the installation of the bare b3 command line interface.

  1. Start by Downloading the (headless) director which can be found here.
  2. Next unpack the director to a location of your choice. You may want to set the PATH to include the install location and make the director accessible for additional use.
  3. Install b3 with the following command:
    • director -r <HEADLESS_REPO> -d <INSTALL_DIR> -p b3 -i org.eclipse.b3.cli.product where
      • -r <HEADLESS_REPO> is the headless p2 update site: Current version is: http://download.eclipse.org/modeling/emft/b3/headless-3.6 (Check the download page for changes of the headless update site.)
      • -d <INSTALL_DIR> is the chosen install location of the headless b3
      • -p b3 is the name of the p2 profile
      • -i org.eclipse.cli.product is the name of the headless b3 base

Launch headless b3

  1. run "b3" script in the directory where b3 is installed with previous step
  2. if no extension is installed, only --stackTrace and -? resp. --help options and runScript command are available:
No command was specified

Usage: b3 command [options...]
 --eclipseLogLevel [DEBUG | INFO |      : Controls the verbosity of the eclipse
 WARNING | ERROR]                       : log trace output. Defaults to global
                                          b3 settings.
 --logLevel [DEBUG | INFO | WARNING |   : Controls the verbosity of the console
 ERROR]                                 : trace output. Defaults to global b3
                                          settings.
 --stacktrace                           : Display stack trace on error
 -? (--help)                            : Print help screen for specified
                                          command

Available commands:
runScript - Runs a set of commands from a script file

Running a script

A script file can be run with b3 command line interface. The script file can contain any valid b3 commands with arguments. Nesting of the script files is allowed, but be careful to avoid endless script loop.

Usage: b3 runScript [options...] <script file>
--eclipseLogLevel [DEBUG | INFO |      : Controls the verbosity of the eclipse
WARNING | ERROR]                       : log trace output. Defaults to global
                                         b3 settings.
--logLevel [DEBUG | INFO | WARNING |   : Controls the verbosity of the console
ERROR]                                 : trace output. Defaults to global b3
                                         settings.
--stacktrace                           : Display stack trace on error
-? (--help)                            : Print help screen for specified
                                         command
-c (--continueonerror)                 : If this flag is set, script execution
                                         will continue after a command fails.

More information

Commands defined in the script file are launched sequentially. The following rules apply:

  • each command is defined on a single line
  • parameters may be enclosed in quotes or double quotes
  • parameters may contain variables ${var}, $var or $env:var, ${env.var}
  • variables are expanded only if parameters are double quoted
  • parameters may contain escaped characters
  • \t, \r and \n are replaced with tab, return or new line
  • empty lines and lines beginning with '#' are comments

Adding extensions

  1. use p2 director to install new features that may contribute new commands
  2. running b3 CLI with extensions prints a usage screen with all available commands
  3. running b3 CLI with specified command prints a usage screen with all available options for that command

Writing a new extension

  1. create a new bundle
  2. create a class extending org.eclipse.b3.cli.AbstractCommand
  3. define class fields with org.kohsuke.args4j.Option or org.kohsuke.args4j.Argument annotations (see args4j manual for more details)
  4. implement run(IProgressMonitor monitor) method
  5. register an extension for org.eclipse.b3.cli.commands (specify implementing class and command name)
  6. add the bundle to your b3 configuration

Copyright © Eclipse Foundation, Inc. All Rights Reserved.