Skip to content

Commit 095b270

Browse files
committed
csh -> tcsh
1 parent 09aa626 commit 095b270

File tree

10 files changed

+45
-26
lines changed

10 files changed

+45
-26
lines changed

CHANGELOG.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1111

1212
### Added
1313

14-
- Support for Csh.
14+
- Support for Tcsh.
1515
- Added `--score` flag to `zoxide add`.
1616

1717
### Changed

README.md

+12
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,18 @@ zoxide can be installed in 4 easy steps:
280280
281281
</details>
282282
283+
<details>
284+
<summary>Tcsh</summary>
285+
286+
> Add this to the <ins>**end**</ins> of your config file (usually `~/.tcshrc`):
287+
>
288+
> ```sh
289+
> zoxide init tcsh > ~/.zoxide.tcsh
290+
> source ~/.zoxide.tcsh
291+
> ```
292+
293+
</details>
294+
283295
<details>
284296
<summary>Xonsh</summary>
285297

contrib/completions/_zoxide

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

contrib/completions/zoxide.bash

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

contrib/completions/zoxide.ts

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/man1/zoxide-init.1

+8
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,14 @@ $profile\fR in PowerShell):
5555
\fBInvoke-Expression (& { (zoxide init powershell | Out-String) })\fR
5656
.fi
5757
.TP
58+
.B tcsh
59+
Add this to the \fBend\fR of your config file (usually \fB~/.tcshrc\fR):
60+
.sp
61+
.nf
62+
\fBzoxide init tcsh > ~/.zoxide.tcsh\fR
63+
\fBsource ~/.zoxide.tcsh\fR
64+
.fi
65+
.TP
5866
.B xonsh
5967
Add this to the \fBend\fR of your config file (usually \fB~/.xonshrc\fR):
6068
.sp

src/cmd/cmd.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -147,14 +147,13 @@ pub enum InitHook {
147147
#[derive(ValueEnum, Clone, Debug)]
148148
pub enum InitShell {
149149
Bash,
150-
#[clap(alias = "tcsh")]
151-
Csh,
152150
Elvish,
153151
Fish,
154152
Nushell,
155153
#[clap(alias = "ksh")]
156154
Posix,
157155
Powershell,
156+
Tcsh,
158157
Xonsh,
159158
Zsh,
160159
}

src/cmd/init.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use rinja::Template;
66
use crate::cmd::{Init, InitShell, Run};
77
use crate::config;
88
use crate::error::BrokenPipeHandler;
9-
use crate::shell::{Bash, Csh, Elvish, Fish, Nushell, Opts, Posix, Powershell, Xonsh, Zsh};
9+
use crate::shell::{Bash, Elvish, Fish, Nushell, Opts, Posix, Powershell, Tcsh, Xonsh, Zsh};
1010

1111
impl Run for Init {
1212
fn run(&self) -> Result<()> {
@@ -17,12 +17,12 @@ impl Run for Init {
1717

1818
let source = match self.shell {
1919
InitShell::Bash => Bash(opts).render(),
20-
InitShell::Csh => Csh(opts).render(),
2120
InitShell::Elvish => Elvish(opts).render(),
2221
InitShell::Fish => Fish(opts).render(),
2322
InitShell::Nushell => Nushell(opts).render(),
2423
InitShell::Posix => Posix(opts).render(),
2524
InitShell::Powershell => Powershell(opts).render(),
25+
InitShell::Tcsh => Tcsh(opts).render(),
2626
InitShell::Xonsh => Xonsh(opts).render(),
2727
InitShell::Zsh => Zsh(opts).render(),
2828
}

src/shell.rs

+15-15
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ macro_rules! make_template {
2424
}
2525

2626
make_template!(Bash, "bash.txt");
27-
make_template!(Csh, "csh.txt");
2827
make_template!(Elvish, "elvish.txt");
2928
make_template!(Fish, "fish.txt");
3029
make_template!(Nushell, "nushell.txt");
3130
make_template!(Posix, "posix.txt");
3231
make_template!(Powershell, "powershell.txt");
32+
make_template!(Tcsh, "tcsh.txt");
3333
make_template!(Xonsh, "xonsh.txt");
3434
make_template!(Zsh, "zsh.txt");
3535

@@ -94,20 +94,6 @@ mod tests {
9494
.stderr("");
9595
}
9696

97-
#[apply(opts)]
98-
fn csh_tcsh(cmd: Option<&str>, hook: InitHook, echo: bool, resolve_symlinks: bool) {
99-
let opts = Opts { cmd, hook, echo, resolve_symlinks };
100-
let source = Csh(&opts).render().unwrap();
101-
102-
Command::new("tcsh")
103-
.args(["-e", "-f", "-s"])
104-
.write_stdin(source)
105-
.assert()
106-
.success()
107-
.stdout("")
108-
.stderr("");
109-
}
110-
11197
#[apply(opts)]
11298
fn elvish_elvish(cmd: Option<&str>, hook: InitHook, echo: bool, resolve_symlinks: bool) {
11399
let opts = Opts { cmd, hook, echo, resolve_symlinks };
@@ -263,6 +249,20 @@ mod tests {
263249
.stderr("");
264250
}
265251

252+
#[apply(opts)]
253+
fn tcsh_tcsh(cmd: Option<&str>, hook: InitHook, echo: bool, resolve_symlinks: bool) {
254+
let opts = Opts { cmd, hook, echo, resolve_symlinks };
255+
let source = Tcsh(&opts).render().unwrap();
256+
257+
Command::new("tcsh")
258+
.args(["-e", "-f", "-s"])
259+
.write_stdin(source)
260+
.assert()
261+
.success()
262+
.stdout("")
263+
.stderr("");
264+
}
265+
266266
#[apply(opts)]
267267
fn xonsh_black(cmd: Option<&str>, hook: InitHook, echo: bool, resolve_symlinks: bool) {
268268
let opts = Opts { cmd, hook, echo, resolve_symlinks };

templates/csh.txt renamed to templates/tcsh.txt

+3-3
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ alias {{cmd}}i __zoxide_zi
6868
{%- endmatch %}
6969

7070
{{ section }}
71-
# To initialize zoxide, add this to your shell configuration file (usually ~/.cshrc or ~/.tcshrc):
71+
# To initialize zoxide, add this to your shell configuration file (usually ~/.tcshrc):
7272
#
73-
# zoxide init csh > ~/.zoxide.csh
74-
# source ~/.zoxide.csh
73+
# zoxide init tcsh > ~/.zoxide.tcsh
74+
# source ~/.zoxide.tcsh

0 commit comments

Comments
 (0)