Package com.atlassian.bitbucket.scm
Interface ScmCommandBuilder<B extends ScmCommandBuilder<B>>
- All Superinterfaces:
CommandBuilder<B>,CommandBuilderSupport<B>
@NotThreadSafe
public interface ScmCommandBuilder<B extends ScmCommandBuilder<B>>
extends CommandBuilder<B>
Augments the
CommandBuilder with SCM-related properties, still supporting creating free-form commands.
SCM command builders are specifically intended to be used with binaries such as git, hg or
svn, which provide a variety of different commands, each accepting different arguments and input and
producing different output, to carry out their functionality.-
Method Summary
Methods inherited from interface com.atlassian.bitbucket.scm.CommandBuilder
argument, argumentAfter, argumentAt, argumentBefore, clearArguments, clearInputHandler, defaultErrorHandler, errorHandler, inputHandler, rawArgument, rawArgumentAfter, rawArgumentAt, rawArgumentBeforeMethods inherited from interface com.atlassian.bitbucket.scm.CommandBuilderSupport
clearEnvironment, defaultExitHandler, exitHandler, removeEnvironment, withEnvironment
-
Method Details
-
build
Builds aCommandwhich, whenexecuted, will provide output to the providedoutputHandlerfor processing.If no
commandhas been set, the first argument is assumed to be the command. For SCMs with unified binaries that have no default command, if no command has been set and no arguments have been provided, implementations may throw an exception rather than executing the process which, most likely, will simply print usage information and exit.- Specified by:
buildin interfaceCommandBuilderSupport<B extends ScmCommandBuilder<B>>- Type Parameters:
T- type for the builder- Parameters:
outputHandler- the handler to receive and process output from the command as it executes- Returns:
- the built command
- Throws:
IllegalStateException- if no command has been set and no arguments were providedNullPointerException- if the providedoutputHandlerisnull
-
command
Sets the command to execute.Most SCMs, such as
git,hgorsvn, have a single unified binary which expects the command to run as its first argument. This property separates that special command argument from the others, allowing other arguments to beclearedwithout clearing the command as well.- Parameters:
command- the SCM command to execute- Returns:
this- Throws:
IllegalArgumentException- if the providedcommandis empty or blankNullPointerException- if the providedcommandisnull
-