
    ix>                         S r SSKJr  SSKJr  SSKJr  SSKrSSKrSSKrSSKJ	r	  SS jr
SS jrSS	 jrSS
 jrSS jrS rSS jrS rSS jrS rS rg)z?Provides tab completion functionality for CLIs built with Fire.    )absolute_import)division)print_functionN)inspectutilsc                 f    US:X  a  [        U [        U5      U5      $ [        U [        U5      U5      $ )Nfish)_FishScript	_Commands_BashScript)name	componentdefault_optionsshells       O/var/www/html/banglarbhumi/venv/lib/python3.13/site-packages/fire/completion.pyScriptr      s1    
f_tYy1?CC	T9Y/	AA    c                   ^ ^^ U=(       d
    [        5       n[        T X5      u  p4nSnSnSnSmSmU UU4S jn	/ n
[        5       nUR                  T 5        UR                  [        UR	                  5       5      5      nUR                  [        UR	                  5       5      5      nU Hb  nU	" U5      R                  SR                  [        XL   R                  X\   5      5      5      S9nU
R                  UR                  UUS	95        Md     S
R                  U
5      nUR                  US9nUR                  T T USR                  U5      T R                  SS5      R                  SS5      R                  SS5      SR                  U5      S9$ )aB  Returns a Bash script registering a completion function for the commands.

Args:
  name: The first token in the commands, also the name of the command.
  commands: A list of all possible commands that tab completion can complete
      to. Each command is a list or tuple of the string tokens that make up
      that command.
  default_options: A dict of options that can be used with any command. Use
      this if there are flags that can always be appended to a command.
Returns:
  A string which is the Bash script. Source the bash script to enable tab
  completion in Bash.
a  # bash completion support for {name}
# DO NOT EDIT.
# This script is autogenerated by fire/completion.py.

_complete-{identifier}()
{{
  local cur prev opts lastcommand
  COMPREPLY=()
  prev="${{COMP_WORDS[COMP_CWORD-1]}}"
  cur="${{COMP_WORDS[COMP_CWORD]}}"
  lastcommand=$(get_lastcommand)

  opts="{default_options}"
  GLOBAL_OPTIONS="{global_options}"

{checks}

  COMPREPLY=( $(compgen -W "${{opts}}" -- ${{cur}}) )
  return 0
}}

get_lastcommand()
{{
  local lastcommand i

  lastcommand=
  for ((i=0; i < ${{#COMP_WORDS[@]}}; ++i)); do
    if [[ ${{COMP_WORDS[i]}} != -* ]] && [[ -n ${{COMP_WORDS[i]}} ]] && [[
      ${{COMP_WORDS[i]}} != $cur ]]; then
      lastcommand=${{COMP_WORDS[i]}}
    fi
  done

  echo $lastcommand
}}

filter_options()
{{
  local opts
  opts=""
  for opt in "$@"
  do
    if ! option_already_entered $opt; then
      opts="$opts $opt"
    fi
  done

  echo $opts
}}

option_already_entered()
{{
  local opt
  for opt in ${{COMP_WORDS[@]:0:$COMP_CWORD}}
  do
    if [ $1 == $opt ]; then
      return 0
    fi
  done
  return 1
}}

is_prev_global()
{{
  local opt
  for opt in $GLOBAL_OPTIONS
  do
    if [ $opt == $prev ]; then
      return 0
    fi
  done
  return 1
}}

complete -F _complete-{identifier} {command}
z;
  case "${{lastcommand}}" in
  {lastcommand_checks}
  esaczQ
    {command})
      {opts_assignment}
      opts=$(filter_options $opts)
    ;;z
      if is_prev_global; then
        opts="${{GLOBAL_OPTIONS}}"
      else
        opts="{options} ${{GLOBAL_OPTIONS}}"
      fiz,
      opts="{options} ${{GLOBAL_OPTIONS}}" c                    > U T:X  a  T$ T$ N )commandr   %opts_assignment_main_command_template#opts_assignment_subcommand_templates    r   _GetOptsAssignmentTemplate/_BashScript.<locals>._GetOptsAssignmentTemplate   s    $2200r    )options)r   opts_assignment
)lastcommand_checks/ .,)r   r   checksr   
identifierglobal_options)
set_GetMapsaddunionkeysformatjoinsortedappendreplace)r   commandsr   r'   options_mapsubcommands_mapbash_completion_templatecheck_wrapperlastcommand_check_templater   linescommands_setr   r   r    r%   r   r   s   `               @@r   r   r   "   s    $,su/19
H2..KZ
-
 
)%+/'1 %,4##C(<(<(>$?@,##C(8(8(:$;<,g09@@;'--o.FGH
 A O
 
LL"))+ 	* 	-  yy'+   &
 %%((?3\\#r*223;CCCL.1 & 	r   c                    U=(       d
    [        5       n[        XU5      u  p4nSnSnSnSn	[        UR                  5       5      R                  [        UR                  5       5      5       Hk  n
XZ    H  nXgR	                  U U
US9-  nM     XJ   R                  U5       H3  nX:g  nXhR	                  U U
U(       a  U	OSUR                  S5      S9-  nM5     Mm     UR	                  S	R                  S
 U 5       5      S9$ )aB  Returns a Fish script registering a completion function for the commands.

Args:
  name: The first token in the commands, also the name of the command.
  commands: A list of all possible commands that tab completion can complete
      to. Each command is a list or tuple of the string tokens that make up
      that command.
  default_options: A dict of options that can be used with any command. Use
      this if there are flags that can always be appended to a command.
Returns:
  A string which is the Fish script. Source the fish script to enable tab
  completion in Fish.
aL  function __fish_using_command
    set cmd (commandline -opc)
    for i in (seq (count $cmd) 1)
        switch $cmd[$i]
        case "-*"
        case "*"
            if [ $cmd[$i] = $argv[1] ]
                return 0
            else
                return 1
            end
        end
    end
    return 1
end

function __option_entered_check
    set cmd (commandline -opc)
    for i in (seq (count $cmd))
        switch $cmd[$i]
        case "-*"
            if [ $cmd[$i] = $argv[1] ]
                return 1
            end
        end
    end
    return 0
end

function __is_prev_global
    set cmd (commandline -opc)
    set global_options {global_options}
    set prev (count $cmd)

    for opt in $global_options
        if [ "--$opt" = $cmd[$prev] ]
            echo $prev
            return 0
        end
    end
    return 1
end

zJcomplete -c {name} -n '__fish_using_command {command}' -f -a {subcommand}
z}complete -c {name} -n '__fish_using_command {command};{prev_global_check} and __option_entered_check --{option}' -l {option}
z and __is_prev_global;)r   r   
subcommandr"   --)r   r   prev_global_checkoptionr   c              3   .   #    U  H  nS U S 3v   M     g7f)"Nr   ).0r>   s     r   	<genexpr>_FishScript.<locals>.<genexpr>  s     I.&m.s   )r'   )r(   r)   r,   r+   r-   lstripr.   )r   r2   r   r'   r3   r4   fish_sourcesubcommand_templateflag_templater=   r   r;   r>   check_neededs                 r   r	   r	      s'    $,su/19
o2..++Z;F- /_))+,223{7G7G7I3JKg%.
// 0  k / &,,^<_l))1=-2t$	 *  k = L" 
		XXI.II 
 
 r   c                    [        U[        5      (       a  UR                  S5      (       a  gU(       a  gU[        L d  U[        L d	  U[
        L a  g[        U[        [        5      5      (       a  g/ n[        R                  " U5      (       a  X%;   a  g[        R                  " U 5      (       a  Uc  [        R                  " U 5      =(       d    0 nUR                  U5      nU(       aG  UR                  S;   a  g[        [        S[        S5      5      n[        UR                   U5      (       a  g[        U[        5      (       a  UR                  S5      (       + $ g)a  Returns whether a member should be included in auto-completion or help.

Determines whether a member of an object with the specified name should be
included in auto-completion or help text(both usage and detailed help).

If the member name starts with '__', it will always be excluded. If it
starts with only one '_', it will be included for all non-string types. If
verbose is True, the members, including the private members, are included.

When not in verbose mode, some modules and functions are excluded as well.

Args:
  component: The component containing the member.
  name: The name of the member.
  member: The member itself.
  class_attrs: (optional) If component is a class, provide this as:
    inspectutils.GetClassAttrsDict(component). If not provided, it will be
    computed.
  verbose: Whether to include private members.
Returns
  A boolean value indicating whether the member should be included.
__FTN)methodproperty_tuplegetter_)
isinstancestr
startswithr   r   r   typeinspectismoduleisclassr   GetClassAttrsDictgetkindgetattrcollectionsobject)r   r   memberclass_attrsverbosemodules_to_hide
class_attrtuplegetters           r   MemberVisiblerb     s   . ctt44	8		>	!_-../f&";__Y 229=Ck&J 
2	2 KdDk	J%%{	3	3cs###	r   c                    [        U [        5      (       a  U R                  5       nO[        R                  " U 5      nUc  [
        R                  " U 5      nU VVs/ s H  u  pE[        XXQUS9(       d  M  XE4PM     snn$ s  snnf )a  Returns a list of the members of the given component.

If verbose is True, then members starting with _ (normally ignored) are
included.

Args:
  component: The component whose members to list.
  class_attrs: (optional) If component is a class, you may provide this as:
    inspectutils.GetClassAttrsDict(component). If not provided, it will be
    computed. If provided, this determines how class members will be treated
    for visibility. In particular, methods are generally hidden for
    non-instantiated classes, but if you wish them to be shown (e.g. for
    completion scripts) then pass in a different class_attr for them.
  verbose: Whether to include private members.
Returns:
  A list of tuples (member_name, member) of all members of the component.
r]   r^   )rO   dictitemsrS   
getmembersr   rV   rb   )r   r]   r^   membersmember_namer\   s         r   VisibleMembersrj   U  s    $ 	4  ooG  +G 00;K7>
7> 3	yv&
( {w
  
s   B 5B c                 h    / nU  H)  nUR                  SS5      nUR                  SU 35        M+     U$ )zTakes a list of fn args and returns a list of the fn's completion strings.

Args:
  fn_args: A list of the args accepted by a function.
Returns:
  A list of possible completion strings for that function.
rN   -r<   )r1   r0   )fn_argscompletionsargs      r   _CompletionsFromArgsrp   v  s?     +c
++c3
CC5z"  
r   c                    [         R                  " U 5      (       d  [         R                  " U 5      (       a8  [        R                  " U 5      n[        UR                  UR                  -   5      $ [        U [        [        45      (       a.  [        [        U 5      5       Vs/ s H  n[        U5      PM     sn$ [         R                  " U 5      (       a  / $ [        XS9 VVs/ s H  u  pE[!        U5      PM     snn$ s  snf s  snnf )a  Gives possible Fire command completions for the component.

A completion is a string that can be appended to a command to continue that
command. These are used for TAB-completions in Bash for Fire CLIs.

Args:
  component: The component whose completions to list.
  verbose: Whether to include all completions, even private members.
Returns:
  A list of completions for a command that would so far return the component.
r^   )rS   	isroutinerU   r   GetFullArgSpecrp   args
kwonlyargsrO   tuplelistrangelenrP   isgeneratorrj   _FormatForCommand)r   r^   specindexri   rN   s         r   Completionsr     s     y!!W__Y%?%?&&y1D		DOO ;<<	E4=))$)#i.$9:$95CJ$9::##I +9F
F.+ $F
  ;
s    C<!Dc                     [        U [        5      (       d  [        U 5      n U R                  S5      (       a  U $ U R                  SS5      $ )a  Replaces underscores with hyphens, unless the token starts with a token.

This is because we typically prefer hyphens to underscores at the command
line, but we reserve hyphens at the start of a token for flags. This becomes
relevant when --verbose is activated, so that things like __str__ don't get
transformed into --str--, which would get confused for a flag.

Args:
  token: The token to transform.
Returns:
  The transformed token.
rN   rl   )rO   rP   rQ   r1   )tokens    r   r|   r|     sA     
E3		JE
cL	sC	  r   c              #   l  #    [         R                  " U 5      (       d  [         R                  " U 5      (       a  [        U SS9 H  nU4v   M
     [         R                  " U 5      (       a  gUS:  a  g[	        U 0 SS9 H2  u  p4[        U5      nU4v   [        XAS-
  5       H  nU4U-   v   M     M4     g7f)a  Yields tuples representing commands.

To use the command from Python, insert '.' between each element of the tuple.
To use the command from the command line, insert ' ' between each element of
the tuple.

Args:
  component: The component considered to be the root of the yielded commands.
  depth: The maximum depth with which to traverse the member DAG for commands.
Yields:
  Tuples, each tuple representing one possible command for this CLI.
  Only traverses the member DAG up to a depth of depth.
Frr   N   rd   )rS   rs   rU   r   rj   r|   r
   )r   depth
completionri   r\   r   s         r   r
   r
     s      y!!W__Y%?%?!)U;
M <y!!

QY
 ,I249;k $K0K.VQY/NW$$ 0;s   B2B4c                 $    U R                  S5      $ )Nrl   )rQ   )ro   s    r   	_IsOptionr     s    		r   c                    ^ [         R                   " T5      n[        R                  " U4S j5      n[        R                  " [        5      nU H  n[	        U5      S:X  aA  [        US   5      (       a  UR                  US   5        M;  XP   R                  US   5        MS  U(       d  M\  US   n[        US   5      n[        U5      (       a  Un	OUn	X   R                  U5        XR                  SS5         R                  U5        M     X4U4$ )a  Returns sets of subcommands and options for each command.

Args:
  name: The first token in the commands, also the name of the command.
  commands: A list of all possible commands that tab completion can complete
      to. Each command is a list or tuple of the string tokens that make up
      that command.
  default_options: A dict of options that can be used with any command. Use
      this if there are flags that can always be appended to a command.
Returns:
  global_options: A set of all options of the first token of the command.
  subcommands_map: A dict storing set of subcommands for each
      command/subcommand.
  options_map: A dict storing set of options for each subcommand.
c                  0   > [         R                   " T 5      $ r   )copy)r   s   r   <lambda>_GetMaps.<locals>.<lambda>  s    		/0Jr   r   r   rN   rl   )	r   rZ   defaultdictr(   rz   r   r*   r|   r1   )
r   r2   r   r'   r3   r4   r   r;   ro   args_maps
     `       r   r)   r)     s      99_-.''(JK+++C0/g
7|q	71:		71:&!!'!*-	2;jgbk*c	3"s#!!#s+,005# & 
o	55r   )Nbashr   )NF)F)   )__doc__
__future__r   r   r   rZ   r   rS   firer   r   r   r	   rb   rj   rp   r   r|   r
   r   r)   r   r   r   <module>r      s_    F &  %    BZzZz6rB:!, %F'6r   