Add $OLDPWD example for cd (#6194)

* add example for cd

* Fix format_conversions tests
This commit is contained in:
Reilly Wood 2022-07-30 20:29:52 -07:00 committed by GitHub
parent 6a4eabf5c7
commit dd2a0e35f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 2 deletions

View File

@ -188,6 +188,11 @@ impl Command for Cd {
example: r#"cd d/s/9"#,
result: None,
},
Example {
description: "Change to the previous working directory ($OLDPWD)",
example: r#"cd -"#,
result: None,
},
]
}
}

View File

@ -56,7 +56,7 @@ fn test_cd_html_color_flag_dark_false() {
);
assert_eq!(
actual.out,
r"<html><style>body { background-color:white;color:black; }</style><body>Change directory.<br><br>Usage:<br> &gt; cd (path) <br><br>Flags:<br> -h, --help<br> Display this help message<br><br>Parameters:<br> (optional) path &lt;Directory&gt;: the path to change to<br><br>Examples:<br> Change to your home directory<br> &gt; <span style='color:#037979;font-weight:bold;'>cd<span style='color:black;font-weight:normal;'> </span></span><span style='color:#037979;'>~<span style='color:black;font-weight:normal;'><br><br> Change to a directory via abbreviations<br> &gt; </span><span style='color:#037979;font-weight:bold;'>cd<span style='color:black;font-weight:normal;'> </span></span></span><span style='color:#037979;'>d/s/9<span style='color:black;font-weight:normal;'><br><br></body></html></span></span>"
r"<html><style>body { background-color:white;color:black; }</style><body>Change directory.<br><br>Usage:<br> &gt; cd (path) <br><br>Flags:<br> -h, --help<br> Display this help message<br><br>Parameters:<br> (optional) path &lt;Directory&gt;: the path to change to<br><br>Examples:<br> Change to your home directory<br> &gt; <span style='color:#037979;font-weight:bold;'>cd<span style='color:black;font-weight:normal;'> </span></span><span style='color:#037979;'>~<span style='color:black;font-weight:normal;'><br><br> Change to a directory via abbreviations<br> &gt; </span><span style='color:#037979;font-weight:bold;'>cd<span style='color:black;font-weight:normal;'> </span></span></span><span style='color:#037979;'>d/s/9<span style='color:black;font-weight:normal;'><br><br> Change to the previous working directory ($OLDPWD)<br> &gt; </span><span style='color:#037979;font-weight:bold;'>cd<span style='color:black;font-weight:normal;'> </span></span></span><span style='color:#037979;'>-<span style='color:black;font-weight:normal;'><br><br></body></html></span></span>"
);
}
@ -71,6 +71,6 @@ fn test_no_color_flag() {
);
assert_eq!(
actual.out,
r"<html><style>body { background-color:white;color:black; }</style><body>Change directory.<br><br>Usage:<br> &gt; cd (path) <br><br>Flags:<br> -h, --help<br> Display this help message<br><br>Parameters:<br> (optional) path &lt;Directory&gt;: the path to change to<br><br>Examples:<br> Change to your home directory<br> &gt; cd ~<br><br> Change to a directory via abbreviations<br> &gt; cd d/s/9<br><br></body></html>"
r"<html><style>body { background-color:white;color:black; }</style><body>Change directory.<br><br>Usage:<br> &gt; cd (path) <br><br>Flags:<br> -h, --help<br> Display this help message<br><br>Parameters:<br> (optional) path &lt;Directory&gt;: the path to change to<br><br>Examples:<br> Change to your home directory<br> &gt; cd ~<br><br> Change to a directory via abbreviations<br> &gt; cd d/s/9<br><br> Change to the previous working directory ($OLDPWD)<br> &gt; cd -<br><br></body></html>"
);
}