# AUTOMATICALLY GENERATED by `shtab`

_shtab_tyro_ns_render_subparsers=('camera-path' 'interpolate' 'spiral' 'dataset')

_shtab_tyro_ns_render_option_strings=('-h' '--help')
_shtab_tyro_ns_render_camera_path_option_strings=('-h' '--help' '--load-config' '--output-path' '--image-format' '--jpeg-quality' '--downscale-factor' '--eval-num-rays-per-chunk' '--rendered-output-names' '--depth-near-plane' '--depth-far-plane' '--render-nearest-camera' '--check-occlusions' '--camera-idx' '--camera-path-filename' '--output-format' '--colormap-options.colormap' '--colormap-options.normalize' '--colormap-options.colormap-min' '--colormap-options.colormap-max' '--colormap-options.invert')
_shtab_tyro_ns_render_interpolate_option_strings=('-h' '--help' '--load-config' '--output-path' '--image-format' '--jpeg-quality' '--downscale-factor' '--eval-num-rays-per-chunk' '--rendered-output-names' '--depth-near-plane' '--depth-far-plane' '--render-nearest-camera' '--check-occlusions' '--camera-idx' '--pose-source' '--interpolation-steps' '--order-poses' '--frame-rate' '--output-format' '--colormap-options.colormap' '--colormap-options.normalize' '--colormap-options.colormap-min' '--colormap-options.colormap-max' '--colormap-options.invert')
_shtab_tyro_ns_render_spiral_option_strings=('-h' '--help' '--load-config' '--output-path' '--image-format' '--jpeg-quality' '--downscale-factor' '--eval-num-rays-per-chunk' '--rendered-output-names' '--depth-near-plane' '--depth-far-plane' '--render-nearest-camera' '--check-occlusions' '--camera-idx' '--seconds' '--output-format' '--frame-rate' '--radius' '--colormap-options.colormap' '--colormap-options.normalize' '--colormap-options.colormap-min' '--colormap-options.colormap-max' '--colormap-options.invert')
_shtab_tyro_ns_render_dataset_option_strings=('-h' '--help' '--load-config' '--output-path' '--image-format' '--jpeg-quality' '--downscale-factor' '--eval-num-rays-per-chunk' '--rendered-output-names' '--depth-near-plane' '--depth-far-plane' '--render-nearest-camera' '--check-occlusions' '--camera-idx' '--data' '--split' '--colormap-options.colormap' '--colormap-options.normalize' '--colormap-options.colormap-min' '--colormap-options.colormap-max' '--colormap-options.invert')

_shtab_tyro_ns_render_camera_path___load_config_COMPGEN=_shtab_compgen_files
_shtab_tyro_ns_render_camera_path___output_path_COMPGEN=_shtab_compgen_files
_shtab_tyro_ns_render_camera_path___camera_path_filename_COMPGEN=_shtab_compgen_files
_shtab_tyro_ns_render_interpolate___load_config_COMPGEN=_shtab_compgen_files
_shtab_tyro_ns_render_interpolate___output_path_COMPGEN=_shtab_compgen_files
_shtab_tyro_ns_render_spiral___load_config_COMPGEN=_shtab_compgen_files
_shtab_tyro_ns_render_spiral___output_path_COMPGEN=_shtab_compgen_files
_shtab_tyro_ns_render_dataset___load_config_COMPGEN=_shtab_compgen_files
_shtab_tyro_ns_render_dataset___output_path_COMPGEN=_shtab_compgen_files
_shtab_tyro_ns_render_dataset___data_COMPGEN=_shtab_compgen_files

_shtab_tyro_ns_render_pos_0_choices=('camera-path' 'interpolate' 'spiral' 'dataset')
_shtab_tyro_ns_render_camera_path___image_format_choices=('jpeg' 'png')
_shtab_tyro_ns_render_camera_path___render_nearest_camera_choices=('True' 'False')
_shtab_tyro_ns_render_camera_path___check_occlusions_choices=('True' 'False')
_shtab_tyro_ns_render_camera_path___output_format_choices=('images' 'video')
_shtab_tyro_ns_render_camera_path___colormap_options_colormap_choices=('default' 'turbo' 'viridis' 'magma' 'inferno' 'cividis' 'gray' 'pca')
_shtab_tyro_ns_render_camera_path___colormap_options_normalize_choices=('True' 'False')
_shtab_tyro_ns_render_camera_path___colormap_options_invert_choices=('True' 'False')
_shtab_tyro_ns_render_interpolate___image_format_choices=('jpeg' 'png')
_shtab_tyro_ns_render_interpolate___render_nearest_camera_choices=('True' 'False')
_shtab_tyro_ns_render_interpolate___check_occlusions_choices=('True' 'False')
_shtab_tyro_ns_render_interpolate___pose_source_choices=('eval' 'train')
_shtab_tyro_ns_render_interpolate___order_poses_choices=('True' 'False')
_shtab_tyro_ns_render_interpolate___output_format_choices=('images' 'video')
_shtab_tyro_ns_render_interpolate___colormap_options_colormap_choices=('default' 'turbo' 'viridis' 'magma' 'inferno' 'cividis' 'gray' 'pca')
_shtab_tyro_ns_render_interpolate___colormap_options_normalize_choices=('True' 'False')
_shtab_tyro_ns_render_interpolate___colormap_options_invert_choices=('True' 'False')
_shtab_tyro_ns_render_spiral___image_format_choices=('jpeg' 'png')
_shtab_tyro_ns_render_spiral___render_nearest_camera_choices=('True' 'False')
_shtab_tyro_ns_render_spiral___check_occlusions_choices=('True' 'False')
_shtab_tyro_ns_render_spiral___output_format_choices=('images' 'video')
_shtab_tyro_ns_render_spiral___colormap_options_colormap_choices=('default' 'turbo' 'viridis' 'magma' 'inferno' 'cividis' 'gray' 'pca')
_shtab_tyro_ns_render_spiral___colormap_options_normalize_choices=('True' 'False')
_shtab_tyro_ns_render_spiral___colormap_options_invert_choices=('True' 'False')
_shtab_tyro_ns_render_dataset___image_format_choices=('jpeg' 'png')
_shtab_tyro_ns_render_dataset___render_nearest_camera_choices=('True' 'False')
_shtab_tyro_ns_render_dataset___check_occlusions_choices=('True' 'False')
_shtab_tyro_ns_render_dataset___split_choices=('train' 'val' 'test' 'train+test')
_shtab_tyro_ns_render_dataset___colormap_options_colormap_choices=('default' 'turbo' 'viridis' 'magma' 'inferno' 'cividis' 'gray' 'pca')
_shtab_tyro_ns_render_dataset___colormap_options_normalize_choices=('True' 'False')
_shtab_tyro_ns_render_dataset___colormap_options_invert_choices=('True' 'False')

_shtab_tyro_ns_render_pos_0_nargs=A...
_shtab_tyro_ns_render__h_nargs=0
_shtab_tyro_ns_render___help_nargs=0
_shtab_tyro_ns_render_camera_path__h_nargs=0
_shtab_tyro_ns_render_camera_path___help_nargs=0
_shtab_tyro_ns_render_camera_path___rendered_output_names_nargs=*
_shtab_tyro_ns_render_interpolate__h_nargs=0
_shtab_tyro_ns_render_interpolate___help_nargs=0
_shtab_tyro_ns_render_interpolate___rendered_output_names_nargs=*
_shtab_tyro_ns_render_spiral__h_nargs=0
_shtab_tyro_ns_render_spiral___help_nargs=0
_shtab_tyro_ns_render_spiral___rendered_output_names_nargs=*
_shtab_tyro_ns_render_dataset__h_nargs=0
_shtab_tyro_ns_render_dataset___help_nargs=0
_shtab_tyro_ns_render_dataset___rendered_output_names_nargs=*


# $1=COMP_WORDS[1]
_shtab_compgen_files() {
  compgen -f -- $1  # files
}

# $1=COMP_WORDS[1]
_shtab_compgen_dirs() {
  compgen -d -- $1  # recurse into subdirs
}

# $1=COMP_WORDS[1]
_shtab_replace_nonword() {
  echo "${1//[^[:word:]]/_}"
}

# set default values (called for the initial parser & any subparsers)
_set_parser_defaults() {
  local subparsers_var="${prefix}_subparsers[@]"
  sub_parsers=${!subparsers_var-}

  local current_option_strings_var="${prefix}_option_strings[@]"
  current_option_strings=${!current_option_strings_var}

  completed_positional_actions=0

  _set_new_action "pos_${completed_positional_actions}" true
}

# $1=action identifier
# $2=positional action (bool)
# set all identifiers for an action's parameters
_set_new_action() {
  current_action="${prefix}_$(_shtab_replace_nonword $1)"

  local current_action_compgen_var=${current_action}_COMPGEN
  current_action_compgen="${!current_action_compgen_var-}"

  local current_action_choices_var="${current_action}_choices[@]"
  current_action_choices="${!current_action_choices_var-}"

  local current_action_nargs_var="${current_action}_nargs"
  if [ -n "${!current_action_nargs_var-}" ]; then
    current_action_nargs="${!current_action_nargs_var}"
  else
    current_action_nargs=1
  fi

  current_action_args_start_index=$(( $word_index + 1 - $pos_only ))

  current_action_is_positional=$2
}

# Notes:
# `COMPREPLY`: what will be rendered after completion is triggered
# `completing_word`: currently typed word to generate completions for
# `${!var}`: evaluates the content of `var` and expand its content as a variable
#     hello="world"
#     x="hello"
#     ${!x} -> ${hello} -> "world"
_shtab_tyro_ns_render() {
  local completing_word="${COMP_WORDS[COMP_CWORD]}"
  local completed_positional_actions
  local current_action
  local current_action_args_start_index
  local current_action_choices
  local current_action_compgen
  local current_action_is_positional
  local current_action_nargs
  local current_option_strings
  local sub_parsers
  COMPREPLY=()

  local prefix=_shtab_tyro_ns_render
  local word_index=0
  local pos_only=0 # "--" delimeter not encountered yet
  _set_parser_defaults
  word_index=1

  # determine what arguments are appropriate for the current state
  # of the arg parser
  while [ $word_index -ne $COMP_CWORD ]; do
    local this_word="${COMP_WORDS[$word_index]}"

    if [[ $pos_only = 1 || " $this_word " != " -- " ]]; then
      if [[ -n $sub_parsers && " ${sub_parsers[@]} " == *" ${this_word} "* ]]; then
        # valid subcommand: add it to the prefix & reset the current action
        prefix="${prefix}_$(_shtab_replace_nonword $this_word)"
        _set_parser_defaults
      fi

      if [[ " ${current_option_strings[@]} " == *" ${this_word} "* ]]; then
        # a new action should be acquired (due to recognised option string or
        # no more input expected from current action);
        # the next positional action can fill in here
        _set_new_action $this_word false
      fi

      if [[ "$current_action_nargs" != "*" ]] && \
         [[ "$current_action_nargs" != "+" ]] && \
         [[ "$current_action_nargs" != *"..." ]] && \
         (( $word_index + 1 - $current_action_args_start_index - $pos_only >= \
            $current_action_nargs )); then
        $current_action_is_positional && let "completed_positional_actions += 1"
        _set_new_action "pos_${completed_positional_actions}" true
      fi
    else
      pos_only=1 # "--" delimeter encountered
    fi

    let "word_index+=1"
  done

  # Generate the completions

  if [[ $pos_only = 0 && "${completing_word}" == -* ]]; then
    # optional argument started: use option strings
    COMPREPLY=( $(compgen -W "${current_option_strings[*]}" -- "${completing_word}") )
  else
    # use choices & compgen
    local IFS=$'\n' # items may contain spaces, so delimit using newline
    COMPREPLY=( $([ -n "${current_action_compgen}" ] \
                  && "${current_action_compgen}" "${completing_word}") )
    unset IFS
    COMPREPLY+=( $(compgen -W "${current_action_choices[*]}" -- "${completing_word}") )
  fi

  return 0
}

complete -o filenames -F _shtab_tyro_ns_render ns-render
