From b55610eeed06e9243ed81f460f88c0a5415aedba Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Thu, 5 May 2022 19:11:30 +0200 Subject: [PATCH] Handle CLI arguments without a value in `OS.get_cmdline_args()` example Command lines such as `--host --address 127.0.0.1` are now parsed as `{"host": "", "address": "127.0.0.1"}`. --- doc/classes/OS.xml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doc/classes/OS.xml b/doc/classes/OS.xml index 859a8ec3d..da0dedb87 100644 --- a/doc/classes/OS.xml +++ b/doc/classes/OS.xml @@ -161,6 +161,10 @@ if argument.find("=") > -1: var key_value = argument.split("=") arguments[key_value[0].lstrip("--")] = key_value[1] + else: + # Options without an argument will be present in the dictionary, + # with the value set to an empty string. + arguments[argument.lstrip("--")] = "" [/codeblock]