File tree Expand file tree Collapse file tree 4 files changed +56
-0
lines changed
Expand file tree Collapse file tree 4 files changed +56
-0
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,8 @@ pwd-usage = pwd [OPTION]...
44# Help messages
55pwd-help-logical = use PWD from environment, even if it contains symlinks
66pwd-help-physical = avoid all symlinks
7+ pwd-help-text = Print help information
8+ pwd-version-text = Print version information
79
810# Error messages
911pwd-error-failed-to-get-current-directory = failed to get current directory
Original file line number Diff line number Diff line change @@ -4,6 +4,8 @@ pwd-usage = pwd [OPTION]...
44# Messages d'aide
55pwd-help-logical = utiliser PWD de l'environnement, même s'il contient des liens symboliques
66pwd-help-physical = éviter tous les liens symboliques
7+ pwd-help-text = Afficher l'aide
8+ pwd-version-text = Afficher les informations de version
79
810# Messages d'erreur
911pwd-error-failed-to-get-current-directory = échec de l'obtention du répertoire actuel
Original file line number Diff line number Diff line change @@ -145,6 +145,22 @@ pub fn uu_app() -> Command {
145145 . about ( translate ! ( "pwd-about" ) )
146146 . override_usage ( format_usage ( & translate ! ( "pwd-usage" ) ) )
147147 . infer_long_args ( true )
148+ . disable_help_flag ( true )
149+ . disable_version_flag ( true )
150+ . arg (
151+ Arg :: new ( "help" )
152+ . short ( 'h' )
153+ . long ( "help" )
154+ . help ( translate ! ( "pwd-help-text" ) )
155+ . action ( ArgAction :: Help ) ,
156+ )
157+ . arg (
158+ Arg :: new ( "version" )
159+ . short ( 'V' )
160+ . long ( "version" )
161+ . help ( translate ! ( "pwd-version-text" ) )
162+ . action ( ArgAction :: Version ) ,
163+ )
148164 . arg (
149165 Arg :: new ( OPT_LOGICAL )
150166 . short ( 'L' )
Original file line number Diff line number Diff line change @@ -15,6 +15,42 @@ fn test_invalid_arg() {
1515 new_ucmd ! ( ) . arg ( "--definitely-invalid" ) . fails_with_code ( 1 ) ;
1616}
1717
18+ #[ test]
19+ fn test_help ( ) {
20+ new_ucmd ! ( )
21+ . arg ( "--help" )
22+ . succeeds ( )
23+ . stdout_contains ( "Display the full filename of the current working directory" )
24+ . stdout_contains ( "--help" )
25+ . stdout_contains ( "--version" ) ;
26+ }
27+
28+ #[ test]
29+ fn test_version ( ) {
30+ new_ucmd ! ( )
31+ . arg ( "--version" )
32+ . succeeds ( )
33+ . stdout_contains ( "uutils coreutils" ) ;
34+ }
35+
36+ #[ test]
37+ fn test_short_help ( ) {
38+ new_ucmd ! ( )
39+ . arg ( "-h" )
40+ . succeeds ( )
41+ . stdout_contains ( "Display the full filename of the current working directory" )
42+ . stdout_contains ( "-h" ) ;
43+ }
44+
45+ #[ test]
46+ fn test_short_version ( ) {
47+ new_ucmd ! ( )
48+ . arg ( "-V" )
49+ . succeeds ( )
50+ . stdout_contains ( "pwd" )
51+ . stdout_contains ( "uutils coreutils" ) ;
52+ }
53+
1854#[ test]
1955fn test_default ( ) {
2056 let ( at, mut ucmd) = at_and_ucmd ! ( ) ;
You can’t perform that action at this time.
0 commit comments