Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error when no positional args #29

Closed
casperdcl opened this issue Jan 2, 2021 · 7 comments · Fixed by #35
Closed

error when no positional args #29

casperdcl opened this issue Jan 2, 2021 · 7 comments · Fixed by #35
Labels
p0-critical Max priority (ASAP) shell-zsh

Comments

@casperdcl
Copy link
Collaborator

On zsh when there are no (only --optional) args, shtab doesn't work tldr-pages/tldr-python-client#135 (comment)

% tldr <TAB>
_arguments:comparguments:312: doubled rest argument definition: *::args:->args
@casperdcl casperdcl added p0-critical Max priority (ASAP) shell-zsh labels Jan 2, 2021
@bl-ue
Copy link

bl-ue commented Mar 18, 2021

Any progress? I'd like to merge tldr-pages/tldr-python-client#135.

@casperdcl
Copy link
Collaborator Author

Ah sorry, will take a look in a couple of weeks (ping me again if I'm not responsive)

@bl-ue
Copy link

bl-ue commented Mar 18, 2021

No problem (thanks for the lightnening fast response! ⚡⚡)

@bl-ue
Copy link

bl-ue commented May 1, 2021

gentle ping, @casperdcl. Any time so far? No problem if not 🙂

casperdcl added a commit that referenced this issue May 3, 2021
@casperdcl
Copy link
Collaborator Author

@bl-ue think it's fixed now :)

@yozachar
Copy link

Hi, this is the completion scripts that gets executed every time zsh is launched.

#'tldr --print-completion zsh'
#compdef tldr

# AUTOMATICALLY GENERATED by `shtab`


_shtab_tldr_commands() {
  local _commands=(
    
  )
  _describe 'tldr commands' _commands
}

_shtab_tldr_options=(
  "(- : *)"{-h,--help}"[show this help message and exit]"
  "(- : *)"{-v,--version}"[show program\'s version number and exit]"
  "--search[Search for a specific command from a query]:search:"
  {-u,--update_cache}"[Update the local cache of pages and exit]"
  {-p,--platform}"[Override the operating system \[linux, osx, sunos, windows, common\]]:platform:(linux osx sunos windows common)"
  {-l,--list}"[List all available commands for operating system]"
  {-s,--source}"[Override the default page source]:source:"
  {-c,--color}"[Override color stripping]"
  {-r,--render}"[Render local markdown files]"
  {-L,--language}"[Override the default language]:language:"
  {-m,--markdown}"[Just print the plain page file.]"
  "(- : *)--print-completion[print shell completion script]:print_completion:(bash zsh tcsh)"
  "(*)::command to lookup:shtab_tldr_cmd_list"
)


_shtab_tldr() {
  local context state line curcontext="$curcontext" one_or_more='(-)*' remainder='(*)'

  if ((${_shtab_tldr_options[(I)${(q)one_or_more}*]} + ${_shtab_tldr_options[(I)${(q)remainder}*]} == 0)); then  # noqa: E501
    _shtab_tldr_options+=(': :_shtab_tldr_commands' '*::: :->tldr')
  fi
  _arguments -C -s $_shtab_tldr_options

  case $state in
    tldr)
      words=($line[1] "${words[@]}")
      (( CURRENT += 1 ))
      curcontext="${curcontext%:*:*}:_shtab_tldr-$line[1]:"
      case $line[1] in
        
      esac
  esac
}

# Custom Preamble
shtab_tldr_cmd_list(){
          _describe 'command' "($("/usr/bin/python" -m tldr --list | sed 's/[^[:alnum:]_]/ /g'))"
        }

# End Custom Preamble


typeset -A opt_args
_shtab_tldr "$@"

But I see this error in the console:

_shtab_tldr:6: command not found: _arguments

@casperdcl
Copy link
Collaborator Author

casperdcl commented Oct 20, 2023

Looks like a problem with your zsh install, vis. https://zsh-users.zsh.narkive.com/u1d54kbu/command-not-found-arguments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p0-critical Max priority (ASAP) shell-zsh
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants