mirror of
https://github.com/openSUSE/osc.git
synced 2025-08-05 15:13:39 +02:00
Merge pull request #1544 from dmach/build-noclean
Document '--buildtool-opt=--noclean' example in 'build' command's help
This commit is contained in:
14
osc/cmdln.py
14
osc/cmdln.py
@@ -6,6 +6,7 @@ A modern, lightweight alternative to cmdln.py from https://github.com/trentm/cmd
|
||||
import argparse
|
||||
import inspect
|
||||
import sys
|
||||
import textwrap
|
||||
|
||||
|
||||
def option(*args, **kwargs):
|
||||
@@ -78,6 +79,19 @@ def hide(value=True):
|
||||
|
||||
|
||||
class HelpFormatter(argparse.RawDescriptionHelpFormatter):
|
||||
def _split_lines(self, text, width):
|
||||
# remove the leading and trailing whitespaces to avoid printing unwanted blank lines
|
||||
text = text.strip()
|
||||
|
||||
result = []
|
||||
for line in text.splitlines():
|
||||
if not line.strip():
|
||||
# textwrap normally returns [] on a string that contains only whitespaces; we want [""] to print a blank line
|
||||
result.append("")
|
||||
else:
|
||||
result.extend(textwrap.wrap(line, width))
|
||||
return result
|
||||
|
||||
def _format_action(self, action):
|
||||
if isinstance(action, argparse._SubParsersAction):
|
||||
parts = []
|
||||
|
@@ -7172,7 +7172,14 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
@cmdln.option('--build-opt', metavar='OPT', action='append',
|
||||
help='pass option OPT to the build command')
|
||||
@cmdln.option('--buildtool-opt', metavar='OPT', action='append',
|
||||
help='pass option OPT to the build tool command (rpmbuild)')
|
||||
help=textwrap.dedent(
|
||||
"""
|
||||
pass option OPT to the build tool command (rpmbuild), for example:
|
||||
* don't clean build environment after a successful build:
|
||||
--buildtool-opt=--noclean
|
||||
"""
|
||||
),
|
||||
)
|
||||
@cmdln.option('--userootforbuild', '--login-as-root', action='store_true',
|
||||
help='Run build or shell as root. The default is to build as '
|
||||
'unprivileged user. Note that a line "# norootforbuild" '
|
||||
|
Reference in New Issue
Block a user