mirror of
https://github.com/ajeetdsouza/zoxide.git
synced 2025-07-07 13:35:03 +00:00
csh -> tcsh
This commit is contained in:
parent
09aa626a86
commit
095b270fea
10 changed files with 45 additions and 26 deletions
|
@ -11,7 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
|
||||
### Added
|
||||
|
||||
- Support for Csh.
|
||||
- Support for Tcsh.
|
||||
- Added `--score` flag to `zoxide add`.
|
||||
|
||||
### Changed
|
||||
|
|
12
README.md
12
README.md
|
@ -280,6 +280,18 @@ zoxide can be installed in 4 easy steps:
|
|||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>Tcsh</summary>
|
||||
|
||||
> Add this to the <ins>**end**</ins> of your config file (usually `~/.tcshrc`):
|
||||
>
|
||||
> ```sh
|
||||
> zoxide init tcsh > ~/.zoxide.tcsh
|
||||
> source ~/.zoxide.tcsh
|
||||
> ```
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>Xonsh</summary>
|
||||
|
||||
|
|
2
contrib/completions/_zoxide
generated
2
contrib/completions/_zoxide
generated
|
@ -114,7 +114,7 @@ _arguments "${_arguments_options[@]}" : \
|
|||
'--help[Print help]' \
|
||||
'-V[Print version]' \
|
||||
'--version[Print version]' \
|
||||
':shell:(bash csh elvish fish nushell posix powershell xonsh zsh)' \
|
||||
':shell:(bash elvish fish nushell posix powershell tcsh xonsh zsh)' \
|
||||
&& ret=0
|
||||
;;
|
||||
(query)
|
||||
|
|
2
contrib/completions/zoxide.bash
generated
2
contrib/completions/zoxide.bash
generated
|
@ -173,7 +173,7 @@ _zoxide() {
|
|||
return 0
|
||||
;;
|
||||
zoxide__init)
|
||||
opts="-h -V --no-cmd --cmd --hook --help --version bash csh elvish fish nushell posix powershell xonsh zsh"
|
||||
opts="-h -V --no-cmd --cmd --hook --help --version bash elvish fish nushell posix powershell tcsh xonsh zsh"
|
||||
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
|
||||
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
|
||||
return 0
|
||||
|
|
2
contrib/completions/zoxide.ts
generated
2
contrib/completions/zoxide.ts
generated
|
@ -189,12 +189,12 @@ const completion: Fig.Spec = {
|
|||
name: "shell",
|
||||
suggestions: [
|
||||
"bash",
|
||||
"csh",
|
||||
"elvish",
|
||||
"fish",
|
||||
"nushell",
|
||||
"posix",
|
||||
"powershell",
|
||||
"tcsh",
|
||||
"xonsh",
|
||||
"zsh",
|
||||
],
|
||||
|
|
|
@ -55,6 +55,14 @@ $profile\fR in PowerShell):
|
|||
\fBInvoke-Expression (& { (zoxide init powershell | Out-String) })\fR
|
||||
.fi
|
||||
.TP
|
||||
.B tcsh
|
||||
Add this to the \fBend\fR of your config file (usually \fB~/.tcshrc\fR):
|
||||
.sp
|
||||
.nf
|
||||
\fBzoxide init tcsh > ~/.zoxide.tcsh\fR
|
||||
\fBsource ~/.zoxide.tcsh\fR
|
||||
.fi
|
||||
.TP
|
||||
.B xonsh
|
||||
Add this to the \fBend\fR of your config file (usually \fB~/.xonshrc\fR):
|
||||
.sp
|
||||
|
|
|
@ -147,14 +147,13 @@ pub enum InitHook {
|
|||
#[derive(ValueEnum, Clone, Debug)]
|
||||
pub enum InitShell {
|
||||
Bash,
|
||||
#[clap(alias = "tcsh")]
|
||||
Csh,
|
||||
Elvish,
|
||||
Fish,
|
||||
Nushell,
|
||||
#[clap(alias = "ksh")]
|
||||
Posix,
|
||||
Powershell,
|
||||
Tcsh,
|
||||
Xonsh,
|
||||
Zsh,
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ use rinja::Template;
|
|||
use crate::cmd::{Init, InitShell, Run};
|
||||
use crate::config;
|
||||
use crate::error::BrokenPipeHandler;
|
||||
use crate::shell::{Bash, Csh, Elvish, Fish, Nushell, Opts, Posix, Powershell, Xonsh, Zsh};
|
||||
use crate::shell::{Bash, Elvish, Fish, Nushell, Opts, Posix, Powershell, Tcsh, Xonsh, Zsh};
|
||||
|
||||
impl Run for Init {
|
||||
fn run(&self) -> Result<()> {
|
||||
|
@ -17,12 +17,12 @@ impl Run for Init {
|
|||
|
||||
let source = match self.shell {
|
||||
InitShell::Bash => Bash(opts).render(),
|
||||
InitShell::Csh => Csh(opts).render(),
|
||||
InitShell::Elvish => Elvish(opts).render(),
|
||||
InitShell::Fish => Fish(opts).render(),
|
||||
InitShell::Nushell => Nushell(opts).render(),
|
||||
InitShell::Posix => Posix(opts).render(),
|
||||
InitShell::Powershell => Powershell(opts).render(),
|
||||
InitShell::Tcsh => Tcsh(opts).render(),
|
||||
InitShell::Xonsh => Xonsh(opts).render(),
|
||||
InitShell::Zsh => Zsh(opts).render(),
|
||||
}
|
||||
|
|
30
src/shell.rs
30
src/shell.rs
|
@ -24,12 +24,12 @@ macro_rules! make_template {
|
|||
}
|
||||
|
||||
make_template!(Bash, "bash.txt");
|
||||
make_template!(Csh, "csh.txt");
|
||||
make_template!(Elvish, "elvish.txt");
|
||||
make_template!(Fish, "fish.txt");
|
||||
make_template!(Nushell, "nushell.txt");
|
||||
make_template!(Posix, "posix.txt");
|
||||
make_template!(Powershell, "powershell.txt");
|
||||
make_template!(Tcsh, "tcsh.txt");
|
||||
make_template!(Xonsh, "xonsh.txt");
|
||||
make_template!(Zsh, "zsh.txt");
|
||||
|
||||
|
@ -94,20 +94,6 @@ mod tests {
|
|||
.stderr("");
|
||||
}
|
||||
|
||||
#[apply(opts)]
|
||||
fn csh_tcsh(cmd: Option<&str>, hook: InitHook, echo: bool, resolve_symlinks: bool) {
|
||||
let opts = Opts { cmd, hook, echo, resolve_symlinks };
|
||||
let source = Csh(&opts).render().unwrap();
|
||||
|
||||
Command::new("tcsh")
|
||||
.args(["-e", "-f", "-s"])
|
||||
.write_stdin(source)
|
||||
.assert()
|
||||
.success()
|
||||
.stdout("")
|
||||
.stderr("");
|
||||
}
|
||||
|
||||
#[apply(opts)]
|
||||
fn elvish_elvish(cmd: Option<&str>, hook: InitHook, echo: bool, resolve_symlinks: bool) {
|
||||
let opts = Opts { cmd, hook, echo, resolve_symlinks };
|
||||
|
@ -263,6 +249,20 @@ mod tests {
|
|||
.stderr("");
|
||||
}
|
||||
|
||||
#[apply(opts)]
|
||||
fn tcsh_tcsh(cmd: Option<&str>, hook: InitHook, echo: bool, resolve_symlinks: bool) {
|
||||
let opts = Opts { cmd, hook, echo, resolve_symlinks };
|
||||
let source = Tcsh(&opts).render().unwrap();
|
||||
|
||||
Command::new("tcsh")
|
||||
.args(["-e", "-f", "-s"])
|
||||
.write_stdin(source)
|
||||
.assert()
|
||||
.success()
|
||||
.stdout("")
|
||||
.stderr("");
|
||||
}
|
||||
|
||||
#[apply(opts)]
|
||||
fn xonsh_black(cmd: Option<&str>, hook: InitHook, echo: bool, resolve_symlinks: bool) {
|
||||
let opts = Opts { cmd, hook, echo, resolve_symlinks };
|
||||
|
|
|
@ -68,7 +68,7 @@ alias {{cmd}}i __zoxide_zi
|
|||
{%- endmatch %}
|
||||
|
||||
{{ section }}
|
||||
# To initialize zoxide, add this to your shell configuration file (usually ~/.cshrc or ~/.tcshrc):
|
||||
# To initialize zoxide, add this to your shell configuration file (usually ~/.tcshrc):
|
||||
#
|
||||
# zoxide init csh > ~/.zoxide.csh
|
||||
# source ~/.zoxide.csh
|
||||
# zoxide init tcsh > ~/.zoxide.tcsh
|
||||
# source ~/.zoxide.tcsh
|
Loading…
Add table
Add a link
Reference in a new issue