mirror of
https://github.com/ajeetdsouza/zoxide.git
synced 2025-07-07 21:45:05 +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
|
### Added
|
||||||
|
|
||||||
- Support for Csh.
|
- Support for Tcsh.
|
||||||
- Added `--score` flag to `zoxide add`.
|
- Added `--score` flag to `zoxide add`.
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
12
README.md
12
README.md
|
@ -280,6 +280,18 @@ zoxide can be installed in 4 easy steps:
|
||||||
|
|
||||||
</details>
|
</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>
|
<details>
|
||||||
<summary>Xonsh</summary>
|
<summary>Xonsh</summary>
|
||||||
|
|
||||||
|
|
2
contrib/completions/_zoxide
generated
2
contrib/completions/_zoxide
generated
|
@ -114,7 +114,7 @@ _arguments "${_arguments_options[@]}" : \
|
||||||
'--help[Print help]' \
|
'--help[Print help]' \
|
||||||
'-V[Print version]' \
|
'-V[Print version]' \
|
||||||
'--version[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
|
&& ret=0
|
||||||
;;
|
;;
|
||||||
(query)
|
(query)
|
||||||
|
|
2
contrib/completions/zoxide.bash
generated
2
contrib/completions/zoxide.bash
generated
|
@ -173,7 +173,7 @@ _zoxide() {
|
||||||
return 0
|
return 0
|
||||||
;;
|
;;
|
||||||
zoxide__init)
|
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
|
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
|
||||||
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
|
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
|
||||||
return 0
|
return 0
|
||||||
|
|
2
contrib/completions/zoxide.ts
generated
2
contrib/completions/zoxide.ts
generated
|
@ -189,12 +189,12 @@ const completion: Fig.Spec = {
|
||||||
name: "shell",
|
name: "shell",
|
||||||
suggestions: [
|
suggestions: [
|
||||||
"bash",
|
"bash",
|
||||||
"csh",
|
|
||||||
"elvish",
|
"elvish",
|
||||||
"fish",
|
"fish",
|
||||||
"nushell",
|
"nushell",
|
||||||
"posix",
|
"posix",
|
||||||
"powershell",
|
"powershell",
|
||||||
|
"tcsh",
|
||||||
"xonsh",
|
"xonsh",
|
||||||
"zsh",
|
"zsh",
|
||||||
],
|
],
|
||||||
|
|
|
@ -55,6 +55,14 @@ $profile\fR in PowerShell):
|
||||||
\fBInvoke-Expression (& { (zoxide init powershell | Out-String) })\fR
|
\fBInvoke-Expression (& { (zoxide init powershell | Out-String) })\fR
|
||||||
.fi
|
.fi
|
||||||
.TP
|
.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
|
.B xonsh
|
||||||
Add this to the \fBend\fR of your config file (usually \fB~/.xonshrc\fR):
|
Add this to the \fBend\fR of your config file (usually \fB~/.xonshrc\fR):
|
||||||
.sp
|
.sp
|
||||||
|
|
|
@ -147,14 +147,13 @@ pub enum InitHook {
|
||||||
#[derive(ValueEnum, Clone, Debug)]
|
#[derive(ValueEnum, Clone, Debug)]
|
||||||
pub enum InitShell {
|
pub enum InitShell {
|
||||||
Bash,
|
Bash,
|
||||||
#[clap(alias = "tcsh")]
|
|
||||||
Csh,
|
|
||||||
Elvish,
|
Elvish,
|
||||||
Fish,
|
Fish,
|
||||||
Nushell,
|
Nushell,
|
||||||
#[clap(alias = "ksh")]
|
#[clap(alias = "ksh")]
|
||||||
Posix,
|
Posix,
|
||||||
Powershell,
|
Powershell,
|
||||||
|
Tcsh,
|
||||||
Xonsh,
|
Xonsh,
|
||||||
Zsh,
|
Zsh,
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@ use rinja::Template;
|
||||||
use crate::cmd::{Init, InitShell, Run};
|
use crate::cmd::{Init, InitShell, Run};
|
||||||
use crate::config;
|
use crate::config;
|
||||||
use crate::error::BrokenPipeHandler;
|
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 {
|
impl Run for Init {
|
||||||
fn run(&self) -> Result<()> {
|
fn run(&self) -> Result<()> {
|
||||||
|
@ -17,12 +17,12 @@ impl Run for Init {
|
||||||
|
|
||||||
let source = match self.shell {
|
let source = match self.shell {
|
||||||
InitShell::Bash => Bash(opts).render(),
|
InitShell::Bash => Bash(opts).render(),
|
||||||
InitShell::Csh => Csh(opts).render(),
|
|
||||||
InitShell::Elvish => Elvish(opts).render(),
|
InitShell::Elvish => Elvish(opts).render(),
|
||||||
InitShell::Fish => Fish(opts).render(),
|
InitShell::Fish => Fish(opts).render(),
|
||||||
InitShell::Nushell => Nushell(opts).render(),
|
InitShell::Nushell => Nushell(opts).render(),
|
||||||
InitShell::Posix => Posix(opts).render(),
|
InitShell::Posix => Posix(opts).render(),
|
||||||
InitShell::Powershell => Powershell(opts).render(),
|
InitShell::Powershell => Powershell(opts).render(),
|
||||||
|
InitShell::Tcsh => Tcsh(opts).render(),
|
||||||
InitShell::Xonsh => Xonsh(opts).render(),
|
InitShell::Xonsh => Xonsh(opts).render(),
|
||||||
InitShell::Zsh => Zsh(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!(Bash, "bash.txt");
|
||||||
make_template!(Csh, "csh.txt");
|
|
||||||
make_template!(Elvish, "elvish.txt");
|
make_template!(Elvish, "elvish.txt");
|
||||||
make_template!(Fish, "fish.txt");
|
make_template!(Fish, "fish.txt");
|
||||||
make_template!(Nushell, "nushell.txt");
|
make_template!(Nushell, "nushell.txt");
|
||||||
make_template!(Posix, "posix.txt");
|
make_template!(Posix, "posix.txt");
|
||||||
make_template!(Powershell, "powershell.txt");
|
make_template!(Powershell, "powershell.txt");
|
||||||
|
make_template!(Tcsh, "tcsh.txt");
|
||||||
make_template!(Xonsh, "xonsh.txt");
|
make_template!(Xonsh, "xonsh.txt");
|
||||||
make_template!(Zsh, "zsh.txt");
|
make_template!(Zsh, "zsh.txt");
|
||||||
|
|
||||||
|
@ -94,20 +94,6 @@ mod tests {
|
||||||
.stderr("");
|
.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)]
|
#[apply(opts)]
|
||||||
fn elvish_elvish(cmd: Option<&str>, hook: InitHook, echo: bool, resolve_symlinks: bool) {
|
fn elvish_elvish(cmd: Option<&str>, hook: InitHook, echo: bool, resolve_symlinks: bool) {
|
||||||
let opts = Opts { cmd, hook, echo, resolve_symlinks };
|
let opts = Opts { cmd, hook, echo, resolve_symlinks };
|
||||||
|
@ -263,6 +249,20 @@ mod tests {
|
||||||
.stderr("");
|
.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)]
|
#[apply(opts)]
|
||||||
fn xonsh_black(cmd: Option<&str>, hook: InitHook, echo: bool, resolve_symlinks: bool) {
|
fn xonsh_black(cmd: Option<&str>, hook: InitHook, echo: bool, resolve_symlinks: bool) {
|
||||||
let opts = Opts { cmd, hook, echo, resolve_symlinks };
|
let opts = Opts { cmd, hook, echo, resolve_symlinks };
|
||||||
|
|
|
@ -68,7 +68,7 @@ alias {{cmd}}i __zoxide_zi
|
||||||
{%- endmatch %}
|
{%- endmatch %}
|
||||||
|
|
||||||
{{ section }}
|
{{ 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
|
# zoxide init tcsh > ~/.zoxide.tcsh
|
||||||
# source ~/.zoxide.csh
|
# source ~/.zoxide.tcsh
|
Loading…
Add table
Add a link
Reference in a new issue