Copilot commented on code in PR #13570:
URL: https://github.com/apache/trafficserver/pull/13570#discussion_r3880123997


##########
doc/appendices/command-line/traffic_ctl.en.rst:
##########
@@ -563,6 +569,28 @@ Display the current value of a configuration record.
    Specifying the file name is not needed as `traffic_ctl` will try to use the 
build(or the runroot if used) information to figure
    out the path to the `records.yaml`.
 
+   ``-c`` accepts at most one file name, so it may be written before or after 
the record
+   names:
+
+   .. code-block:: bash
+
+      $ traffic_ctl config get -c records.yaml proxy.config.diags.debug.enabled
+      $ traffic_ctl config get proxy.config.diags.debug.enabled -c records.yaml
+      $ traffic_ctl config get --cold=records.yaml 
proxy.config.diags.debug.enabled
+
+   When no file name is given, write ``-c`` last, or use the ``--cold=`` form 
for the
+   explicit file. A bare ``-c`` followed by a record name takes the record as 
the file name,
+   which leaves the command with no records of its own and is reported as a 
usage error:
+
+   .. code-block:: bash
+
+      $ traffic_ctl config get proxy.config.diags.debug.enabled -c    # 
default records.yaml
+      $ traffic_ctl config get -c proxy.config.diags.debug.enabled
+      Error: at least one argument expected by get
+
+   ``-c`` is also given at most once, so repeating it is a usage error rather 
than the last
+   file name silently winning.

Review Comment:
   The docs say repeating ``-c`` is a usage error, but only the ``--cold=FILE`` 
form is currently rejected. With the space-separated form (e.g. ``-c file1 -c 
file2``), `ArgParser` overwrites earlier values (see `Arguments::append()` in 
src/tscore/ArgParser.cc), so the last file name can still silently win. Please 
either tighten the wording to match current behavior, or add enforcement for 
repeated `-c/--cold` in all forms.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to