diff options
| author | Ulf Magnusson <ulfalizer@gmail.com> | 2019-06-06 20:45:45 +0200 |
|---|---|---|
| committer | Ulf Magnusson <ulfalizer@gmail.com> | 2019-06-07 06:10:04 +0200 |
| commit | f503ea39a10f685bf3fc2fb21f2748aad6c5ee99 (patch) | |
| tree | 4bbee0873724f845a7723f3c384fbc1d2caab6a7 | |
| parent | 5ace27e6d7562dd77e619f39803258fe63d4ca95 (diff) | |
dumpvars: Make the output format copy-pasteable
Have it write assignments on a single line that can be copy-pasted
before a command.
| -rw-r--r-- | examples/dumpvars.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/examples/dumpvars.py b/examples/dumpvars.py index 5ce65c2..0f8ab43 100644 --- a/examples/dumpvars.py +++ b/examples/dumpvars.py @@ -1,5 +1,5 @@ -# Shows a list of all (set) environment variables referenced in the Kconfig -# files, together with their values. +# Prints all (set) environment variables referenced in the Kconfig files +# together with their values, as a list of assignments. # # Note: This only works for environment variables referenced via the $(FOO) # preprocessor syntax. The older $FOO syntax is maintained for backwards @@ -11,5 +11,5 @@ import sys import kconfiglib -for var in kconfiglib.Kconfig(sys.argv[1]).env_vars: - print("{:16} '{}'".format(var, os.environ[var])) +print(" ".join("{}='{}'".format(var, os.environ[var]) + for var in kconfiglib.Kconfig(sys.argv[1]).env_vars)) |
