sahvx655-wq created FELIX-6842:
----------------------------------

             Summary: gogo-jline: Implement support for -u (UTC) option in date 
command
                 Key: FELIX-6842
                 URL: https://issues.apache.org/jira/browse/FELIX-6842
             Project: Felix
          Issue Type: Bug
          Components: Gogo JLine
            Reporter: sahvx655-wq


The JLine shell {{date}} command documentation specifies support for the {{-u}} 
(UTC) timezone option, but the current implementation in 
{{org.apache.felix.gogo.jline.Posix.java}} does not recognize it in the 
argument parsing logic. As a result, using {{-u}} causes an 
{{{}IllegalArgumentException{}}}.

The usage documentation includes the {{-u}} flag, but it is not handled during 
option parsing and falls through to the default error case.

This change adds proper handling for the {{-u}} option by detecting it during 
argument parsing and treating it as a valid flag. When {{-u}} is specified, the 
command switches to UTC mode by configuring {{SimpleDateFormat}} with the UTC 
timezone for formatting and parsing.

A unit test {{testDateUtc}} has been added in {{PosixTest.java}} to verify the 
behavior. It confirms that {{date -u '+%z'}} produces the correct UTC output.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to