cmd

package
v0.1.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 23, 2024 License: MIT Imports: 12 Imported by: 1

Documentation

Overview

Copyright © 2024 lflxp <[email protected]>

Copyright © 2024 lflxp <[email protected]>

Copyright © 2024 lflxp <[email protected]>

Copyright © 2024 NAME HERE <EMAIL ADDRESS>

Copyright © 2024 lflxp <[email protected]>

Index

Constants

View Source
const ZshCompletion = `compdef _k k                                                                                                                                                                                                                                                                    # 添加 _gmt 函数

__smkubectl-cli_debug()
{
    local file="$BASH_COMP_DEBUG_FILE"
    if [[ -n ${file} ]]; then
        echo "$*" >> "${file}"
    fi
}

_k() {
  local matches namespace result

  # 获取一次性结果
  result=$(command smkubectl smart ${LBUFFER})

  __smkubectl-cli_debug "namespace ${result}"
  namespace=$(command echo ${result}|head -1|awk '/^NAMESPACE/ {print "yes"}')
  __smkubectl-cli_debug "namespace ${namespace}"
  # 根据标题是否含有NAMESPACE动态切换显示结果
  if [[ -n "$namespace" ]]; then
    matches=$(command echo ${result} | FZF_DEFAULT_OPTS="--height ${FZF_TMUX_HEIGHT:-50%} --header-lines=1 --min-height 15 --reverse $FZF_DEFAULT_OPTS --preview 'echo {}' --preview-window down:3:wrap $FZF_COMPLETION_OPTS" smkubectl -m|awk '{print "-n "$1" "$2}'|tr '\n' ' ')
  else
    matches=$(command echo ${result} | FZF_DEFAULT_OPTS="--height ${FZF_TMUX_HEIGHT:-50%} --header-lines=1 --min-height 15 --reverse $FZF_DEFAULT_OPTS --preview 'echo {}' --preview-window down:3:wrap $FZF_COMPLETION_OPTS" smkubectl -m|awk '{print $1}'|tr '\n' ' ')
  fi
  #_describe 'command' ns
  if [ -n "$matches" ]; then
    LBUFFER="${LBUFFER}$matches"
    # LBUFFER="${BUFFER} $matches"
  fi
  zle reset-prompt
}

zle -N _k
#定义快捷键为: [Esc] [Esc]
` + "bindkey '`' _k"
View Source
const ZshCompletionDebug = `compdef _k k                                                                                                                                                                                                                                                                    # 添加 _gmt 函数

__smkubectl-cli_debug()
{
    local file="$BASH_COMP_DEBUG_FILE"
    if [[ -n ${file} ]]; then
        echo "$*" >> "${file}"
    fi
}

_k() {
  local matches namespace result

  # 获取一次性结果
  result=$(command smkubectl smart -d ${LBUFFER})

  __smkubectl-cli_debug "namespace ${result}"
  namespace=$(command echo ${result}|head -1|awk '/^NAMESPACE/ {print "yes"}')
  __smkubectl-cli_debug "namespace ${namespace}"
  # 根据标题是否含有NAMESPACE动态切换显示结果
  if [[ -n "$namespace" ]]; then
    matches=$(command echo ${result} | FZF_DEFAULT_OPTS="--height ${FZF_TMUX_HEIGHT:-50%} --header-lines=1 --min-height 15 --reverse $FZF_DEFAULT_OPTS --preview 'echo {}' --preview-window down:3:wrap $FZF_COMPLETION_OPTS" smkubectl -m|awk '{print "-n "$1" "$2}'|tr '\n' ' ')
  else
    matches=$(command echo ${result} | FZF_DEFAULT_OPTS="--height ${FZF_TMUX_HEIGHT:-50%} --header-lines=1 --min-height 15 --reverse $FZF_DEFAULT_OPTS --preview 'echo {}' --preview-window down:3:wrap $FZF_COMPLETION_OPTS" smkubectl -m|awk '{print $1}'|tr '\n' ' ')
  fi
  #_describe 'command' ns
  if [ -n "$matches" ]; then
    LBUFFER="${LBUFFER}$matches"
    # LBUFFER="${BUFFER} $matches"
  fi
  zle reset-prompt
}

zle -N _k
#定义快捷键为: [Esc] [Esc]
` + "bindkey '`' _k"

Variables

This section is empty.

Functions

func ContainsString

func ContainsString(slice []string, s string) bool

func Execute

func Execute()

Execute adds all child commands to the root command and sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.

func ParseCmd

func ParseCmd(in string)

解析命令 只负责执行 不负责命令补全

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL