Skip to content

Commit 5e2b386

Browse files
committed
Add command which returns job config in xml
Fixes #30
1 parent 0a74058 commit 5e2b386

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

contrib/bash-completion/jenkins

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ _jenkins()
1111
builds \
1212
start \
1313
info \
14+
configxml \
1415
setbranch \
1516
stop \
1617
console \
@@ -28,7 +29,7 @@ _jenkins()
2829
COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
2930
return 0
3031
;;
31-
queue|building|builds|start|info|setbranch|stop|console|changes)
32+
queue|building|builds|start|info|configxml|setbranch|stop|console|changes)
3233
opts="-h --help"
3334
COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
3435
return 0

jenkins_cli/cli.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,11 @@ def info(self, args):
192192
scm_name,
193193
branch_name))
194194

195+
def configxml(self, args):
196+
job_name = self._check_job(args.job_name)
197+
job_config = self.jenkins.get_job_config(job_name)
198+
print(job_config)
199+
195200
def setbranch(self, args):
196201
job_name = self._check_job(args.job_name)
197202
xml = self.jenkins.get_job_config(job_name)

jenkins_cli/cli_arguments.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ def load_parser():
4343
start_parser = subparsers.add_parser('info', help='Job info')
4444
start_parser.add_argument('job_name', help='Job to get info for')
4545

46+
start_parser = subparsers.add_parser('configxml', help='Job config in xml format')
47+
start_parser.add_argument('job_name', help='Job to get config for')
48+
4649
set_branch = subparsers.add_parser('setbranch', help='Set VCS branch (Mercurial or Git)')
4750
set_branch.add_argument('job_name', help='Job to set branch for')
4851
set_branch.add_argument('branch_name', help='Name of the VCS branch')

0 commit comments

Comments
 (0)