Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ You may also obtain specific shell configuration using.
leetcode completions fish
```

If no argument is provided, the shell is inferred from the `SHELL` environment variable.

</details>

## Usage
Expand Down
5 changes: 1 addition & 4 deletions src/cmds/completions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,7 @@ fn get_completions_string<G: Generator>(gen: G, cmd: &mut ClapCommand) -> Result
pub fn completion_handler(m: &ArgMatches, cmd: &mut ClapCommand) -> Result<(), Error> {
let shell = *m.get_one::<Shell>("shell").unwrap_or(
// if shell value is not provided try to get from the environment
{
println!("# Since shell arg value is not provided trying to get the default shell from the environment.");
&Shell::from_env().ok_or(Error::MatchError)?
}
&Shell::from_env().ok_or(Error::MatchError)?,
);
let completions = get_completions_string(shell, cmd)?;
println!("{}", completions);
Expand Down