Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
CommandLine
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Robert Goldmann
CommandLine
Wiki
Create own commands
Changes
Page history
New page
Templates
Clone repository
Created Create own commands (markdown)
authored
8 years ago
by
Robert Goldmann
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
Create-own-commands.md
+23
-0
23 additions, 0 deletions
Create-own-commands.md
with
23 additions
and
0 deletions
Create-own-commands.md
0 → 100644
View page @
8d5da8d1
### 1. use template "CommandNew"
### 2. fill constructor with your keyword and number of params
```
java
public
CommandNew
()
{
super
.
keyword
=
"your-keyword"
;
super
.
numberOfParams
=
0
;
super
.
helptText
=
"help.your-keyword"
;
}
```
### 3. in execute method implement your code after the `isValid()` check
Note:
-
`command[0]`
is the commandname,
`command[1]`
ist the first useabel paramater
-
you can use
`bundle.getController().print(message);`
to print a result to the console
-
if you have to enter custom variables in the command you have to pass them via the
`CommandBundle`
### 4. add your Command to `PossibleCommands`
### 5. implement help text in `_en.properties` !IMPORTANT
For additional examples look into included standard commands (list, help, clear)
This diff is collapsed.
Click to expand it.