diff --git a/cygwin/Install.cmd b/cygwin/Install.cmd deleted file mode 100644 index eda9213..0000000 --- a/cygwin/Install.cmd +++ /dev/null @@ -1,47 +0,0 @@ -@echo off - -set VERSION=8.4-dev -echo. -echo ####################################### -echo # Welcome to ks-tools installer %VERSION% # -echo ####################################### -echo. -echo - This installer simply creates a shortcut to the -echo application on your desktop. We recommend that -echo before continuing, make sure you have left the -echo application folder in a place where no one can -echo delete it. -echo. -echo Examples: -echo - C:\ks-tools -echo - C:\Program Files\ks-tools -echo. -echo * Press ENTER to continue or Ctrl+C to exit -pause > nul -echo. -echo * Creating shortchut (%USERPROFILE%\Desktop\ks-tools.lnk) -set SCRIPT="%TEMP%\%RANDOM%-%RANDOM%.vbs" -echo Set oWS = WScript.CreateObject("WScript.Shell") >> %SCRIPT% -echo sLinkFile = "%USERPROFILE%\Desktop\ks-tools.lnk" >> %SCRIPT% -echo Set oLink = oWS.CreateShortcut(sLinkFile) >> %SCRIPT% -echo oLink.TargetPath = "%~d0%~p0\ks-tools.cmd" >> %SCRIPT% -echo oLink.WorkingDirectory = "%~d0%~p0" >> %SCRIPT% -echo oLink.IconLocation = "%~d0%~p0\prompt\ks-tools.ico" >> %SCRIPT% -echo oLink.Save >> %SCRIPT% -cscript /nologo %SCRIPT% -del %SCRIPT% -rem echo * Creating shortchut (%USERPROFILE%\Desktop\ks-tools (ZUI).lnk) -rem set SCRIPT="%TEMP%\%RANDOM%-%RANDOM%.vbs" -rem echo Set oWS = WScript.CreateObject("WScript.Shell") >> %SCRIPT% -rem echo sLinkFile = "%USERPROFILE%\Desktop\ks-tools (ZUI).lnk" >> %SCRIPT% -rem echo Set oLink = oWS.CreateShortcut(sLinkFile) >> %SCRIPT% -rem echo oLink.TargetPath = "%~d0%~p0\ks-tools-zui.cmd" >> %SCRIPT% -rem echo oLink.WorkingDirectory = "%~d0%~p0" >> %SCRIPT% -rem echo oLink.IconLocation = "%~d0%~p0\prompt\ks-tools.ico" >> %SCRIPT% -rem echo oLink.Save >> %SCRIPT% -rem cscript /nologo %SCRIPT% -rem del %SCRIPT% -echo. -echo * Shortcuts created! -echo. -pause diff --git a/cygwin/bin/files-here.txt b/cygwin/bin/files-here.txt deleted file mode 100644 index d8a76e1..0000000 --- a/cygwin/bin/files-here.txt +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/bash - -# Copy necessary tools for Cygwin/Windows version -# After, you must copy all files to /bin directory -mkdir -p ${HOME}/ks-tools/bin/ -cd /usr/bin - -# All executables - -list_binary="bash cat clear cut cygwin-console-helper date echo expr ffmpeg ffprobe find grep head ls md5sum mkdir mv cp rm rsync scp sed sleep ssh-add ssh-agent ssh-keygen ssh-keyscan ssh sshpass tail tr wc pwd mintty file ldd touch nano chmod chown make" - -echo "* Copying script bashbug" -cp -rfv /usr/bin/bashbug ${HOME}/ks-tools/bin/ -for binary in ${list_binary} ; do - echo "* Copying binary ${binary}" - cp -rfv /usr/bin/${binary}.exe ${HOME}/ks-tools/bin/ - echo "* Searching dependencies for ${binary}" - ldd /usr/bin/${binary}.exe | grep "/bin/" | cut -d ">" -f 2 | cut -d "(" -f 1 | tr -s " " > /tmp/deps.txt - file_size=$(cat /tmp/deps.txt | wc -l) - file_scan=1 - echo "* Copying dependencies for ${binary}" - while [ ${file_scan} -le ${file_size} ] ; do - library=$(cat /tmp/deps.txt | head -${file_scan} | tail -1) - cp -rfv ${library} ${HOME}/ks-tools/bin/ - file_scan=$(expr ${file_scan} + 1) - done -done -strip --strip-all ${HOME}/ks-tools/bin/* -cp -rfv /usr/bin/cyggcc_s-*.dll ${HOME}/ks-tools/bin/ -cp -rfv /usr/bin/cygwin1.dll ${HOME}/ks-tools/bin/ -cp -rfv /usr/bin/cygz.dll ${HOME}/ks-tools/bin/ - -# Finally, copy ks-tools scripts here. diff --git a/cygwin/home/home-here b/cygwin/home/home-here deleted file mode 100644 index e69de29..0000000 diff --git a/cygwin/ks-tools-cmd.cmd b/cygwin/ks-tools-cmd.cmd deleted file mode 100644 index 0a9a54c..0000000 --- a/cygwin/ks-tools-cmd.cmd +++ /dev/null @@ -1,21 +0,0 @@ -@echo off - -rem ###################################### -rem # ks-tools for Windows # -rem # U. Modificacion: 04-02-2022 # -rem # Author: q3aql # -rem # Contact: q3aql@duck.com # -rem # License: GPL v2.0 # -rem ###################################### -set VERSION=8.4-dev - -rem # Start ks-tools terminal (bash) -cd "%~d0%~p0" -mkdir home\%USERNAME% -mkdir tmp -copy /Y prompt\.bashrc home\%USERNAME% -copy /Y prompt\.minttyrc home\%USERNAME% -cls -set PATH=%PATH%;%~d0%~p0\bin -bin\bash.exe -rem bash diff --git a/cygwin/ks-tools.cmd b/cygwin/ks-tools.cmd deleted file mode 100644 index fa50cb1..0000000 --- a/cygwin/ks-tools.cmd +++ /dev/null @@ -1,21 +0,0 @@ -@echo off - -rem ###################################### -rem # ks-tools for Windows # -rem # U. Modificacion: 04-02-2022 # -rem # Author: q3aql # -rem # Contact: q3aql@duck.com # -rem # License: GPL v2.0 # -rem ###################################### -set VERSION=8.4-dev - -rem # Start ks-tools terminal (bash) -cd "%~d0%~p0" -mkdir home\%USERNAME% -mkdir tmp -copy /Y prompt\.bashrc home\%USERNAME% -copy /Y prompt\.minttyrc home\%USERNAME% -cls -set PATH=%PATH%;%~d0%~p0\bin -bin\mintty.exe -rem bash diff --git a/cygwin/prompt/.bashrc b/cygwin/prompt/.bashrc deleted file mode 100644 index 9562e6f..0000000 --- a/cygwin/prompt/.bashrc +++ /dev/null @@ -1,210 +0,0 @@ -# ~/.bashrc: executed by bash(1) for non-login shells. -# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc) -# for examples - -# If not running interactively, don't do anything -case $- in - *i*) ;; - *) return;; -esac - -# don't put duplicate lines or lines starting with space in the history. -# See bash(1) for more options -HISTCONTROL=ignoreboth - -# append to the history file, don't overwrite it -shopt -s histappend - -# for setting history length see HISTSIZE and HISTFILESIZE in bash(1) -HISTSIZE=1000 -HISTFILESIZE=2000 - -# check the window size after each command and, if necessary, -# update the values of LINES and COLUMNS. -shopt -s checkwinsize - -# If set, the pattern "**" used in a pathname expansion context will -# match all files and zero or more directories and subdirectories. -#shopt -s globstar - -# make less more friendly for non-text input files, see lesspipe(1) -#[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)" - -# set variable identifying the chroot you work in (used in the prompt below) -if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then - debian_chroot=$(cat /etc/debian_chroot) -fi - -# set a fancy prompt (non-color, unless we know we "want" color) -case "$TERM" in - xterm-color|*-256color) color_prompt=yes;; -esac - -# uncomment for a colored prompt, if the terminal has the capability; turned -# off by default to not distract the user: the focus in a terminal window -# should be on the output of commands, not on the prompt -#force_color_prompt=yes - -if [ -n "$force_color_prompt" ]; then - if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then - # We have color support; assume it's compliant with Ecma-48 - # (ISO/IEC-6429). (Lack of such support is extremely rare, and such - # a case would tend to support setf rather than setaf.) - color_prompt=yes - else - color_prompt= - fi -fi - -if [ "$color_prompt" = yes ]; then - PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]ks-tools\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' -else - PS1='${debian_chroot:+($debian_chroot)}ks-tools:\w\$ ' -fi -unset color_prompt force_color_prompt - -# If this is an xterm set the title to user@host:dir -case "$TERM" in -xterm*|rxvt*) - PS1="\[\e]ks-tools: \w\a\]$PS1" - ;; -*) - ;; -esac - -# enable color support of ls and also add handy aliases -if [ -x /usr/bin/dircolors ]; then - test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)" - alias ls='ls --color=auto' - #alias dir='dir --color=auto' - #alias vdir='vdir --color=auto' - - #alias grep='grep --color=auto' - #alias fgrep='fgrep --color=auto' - #alias egrep='egrep --color=auto' -fi - -# colored GCC warnings and errors -#export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01' - -# some more ls aliases -#alias ll='ls -l' -#alias la='ls -A' -#alias l='ls -CF' - -# Alias definitions. -# You may want to put all your additions into a separate file like -# ~/.bash_aliases, instead of adding them here directly. -# See /usr/share/doc/bash-doc/examples in the bash-doc package. - -if [ -f ~/.bash_aliases ]; then - . ~/.bash_aliases -fi - -# enable programmable completion features (you don't need to enable -# this, if it's already enabled in /etc/bash.bashrc and /etc/profile -# sources /etc/bash.bashrc). -if ! shopt -oq posix; then - if [ -f /usr/share/bash-completion/bash_completion ]; then - . /usr/share/bash-completion/bash_completion - elif [ -f /etc/bash_completion ]; then - . /etc/bash_completion - fi -fi - -# List of alias -alias cat="/usr/bin/cat" -alias clear="/usr/bin/clear" -alias cut="/usr/bin/cut" -alias date="/usr/bin/date" -alias echo="/usr/bin/echo" -alias expr="/usr/bin/expr" -alias ffmpeg="/usr/bin/ffmpeg" -alias ffplay="/usr/bin/ffplay" -alias ffprobe="/usr/bin/ffprobe" -alias file="/usr/bin/file" -alias find="/usr/bin/find" -alias ftp="/usr/bin/ftp" -alias grep="/usr/bin/grep" -alias head="/usr/bin/head" -alias ldd="/usr/bin/ldd" -alias ls="/usr/bin/ls" -alias md5sum="/usr/bin/md5sum" -alias mintty="/usr/bin/mintty" -alias mkdir="/usr/bin/mkdir" -alias mv="/usr/bin/mv" -alias pwd="/usr/bin/pwd" -alias rm="/usr/bin/rm" -alias rsync="/usr/bin/rsync" -alias scp="/usr/bin/scp" -alias sed="/usr/bin/sed" -alias sleep="/usr/bin/sleep" -alias ssh-add="/usr/bin/ssh-add" -alias ssh-agent="/usr/bin/ssh-agent" -alias ssh-keygen="/usr/bin/ssh-keygen" -alias ssh-keyscan="/usr/bin/ssh-keyscan" -alias ssh="/usr/bin/ssh" -alias sshpass="/usr/bin/sshpass" -alias tail="/usr/bin/tail" -alias touch="/usr/bin/touch" -alias tr="/usr/bin/tr" -alias wc="/usr/bin/wc" -alias x264="/usr/bin/x264" -alias zenity="/usr/bin/zenity" -alias all-commands='ls /bin | grep ".exe" | cut -d "." -f 1' - -# List of alias for drives: -alias A:="/cygdrive/a" -alias B:="/cygdrive/b" -alias C:="/cygdrive/c" -alias D:="/cygdrive/d" -alias E:="/cygdrive/e" -alias F:="/cygdrive/f" -alias G:="/cygdrive/g" -alias H:="/cygdrive/h" -alias I:="/cygdrive/i" -alias J:="/cygdrive/j" -alias K:="/cygdrive/k" -alias L:="/cygdrive/l" -alias M:="/cygdrive/m" -alias N:="/cygdrive/n" -alias O:="/cygdrive/o" -alias P:="/cygdrive/p" -alias Q:="/cygdrive/q" -alias R:="/cygdrive/r" -alias S:="/cygdrive/s" -alias T:="/cygdrive/t" -alias U:="/cygdrive/u" -alias V:="/cygdrive/v" -alias W:="/cygdrive/w" -alias X:="/cygdrive/x" -alias Y:="/cygdrive/y" -alias Z:="/cygdrive/z" - - -# Show menu of ks-tools -echo "" -echo " #######################################" -echo " # ks-tools 8.3.1 (for Windows/Cygwin) #" -echo " #######################################" -echo "" -echo " * Note:" -echo " - C: is /cygdrive/c" -echo " Example: cd /cygdrive/c/Users/Default/Desktop" -echo "" -echo " * Available commands:" -echo "" -echo " - ks-upv - ks-crop" -echo " - ks-upa - ks-oga" -echo " - ks-upf - ks-oga-album" -echo " - ks-upr - ks-mp4-wrapper" -echo " - ks-mp4 - ks-avi-wrapper" -echo " - ks-mp4k - ks-vob-wrapper" -echo " - ks-mp4s - ks-mp4k-wrapper" -echo " - ks-mix - ks-mp4s-wrapper" -echo " - ks-avi - ks-mp4s-folder" -echo " - ks-mp3 - ks-mp3-album" -echo " - ks-vob - ks-conf" -echo "" -echo " * Type 'all-commands' for show all commands." -echo "" diff --git a/cygwin/prompt/.minttyrc b/cygwin/prompt/.minttyrc deleted file mode 100644 index e33a6d7..0000000 --- a/cygwin/prompt/.minttyrc +++ /dev/null @@ -1,4 +0,0 @@ -Font=Consolas -FontHeight=11 -Columns=120 -Rows=27 diff --git a/cygwin/prompt/ks-tools-zui.cmd.disabled b/cygwin/prompt/ks-tools-zui.cmd.disabled deleted file mode 100644 index a7209b3..0000000 --- a/cygwin/prompt/ks-tools-zui.cmd.disabled +++ /dev/null @@ -1,19 +0,0 @@ -@echo off - -rem ###################################### -rem # ks-tools for Windows # -rem # U. Modificacion: 04-02-2022 # -rem # Author: q3aql # -rem # Contact: q3aql@duck.com # -rem # License: GPL v2.0 # -rem ###################################### -set VERSION=8.3.1 - -rem # Start ks-tools ZUI (bash) -mkdir home\%USERNAME% -mkdir tmp -copy /Y prompt\.bashrc home\%USERNAME% -copy /Y prompt\.minttyrc home\%USERNAME% -cls -set PATH=%PATH%;%~d0%~p0\bin -bin\bash.exe bin\ks-zui diff --git a/cygwin/prompt/ks-tools.ico b/cygwin/prompt/ks-tools.ico deleted file mode 100644 index 8c1ae78..0000000 Binary files a/cygwin/prompt/ks-tools.ico and /dev/null differ diff --git a/cygwin/prompt/ks-tools.png b/cygwin/prompt/ks-tools.png deleted file mode 100644 index 3f0dd0f..0000000 Binary files a/cygwin/prompt/ks-tools.png and /dev/null differ diff --git a/cygwin/prompt/ks-zui.disabled b/cygwin/prompt/ks-zui.disabled deleted file mode 100644 index d5b4194..0000000 --- a/cygwin/prompt/ks-zui.disabled +++ /dev/null @@ -1,380 +0,0 @@ -#!/bin/bash - -################################################################# -# ks-zui (ks-tools) - Simple zenity user interface for ks-tools # -# Date: 04-02-2022 # -# Author: q3aql # -# Contact: q3aql@duck.com # -################################################################# -VERSION="8.3.1 (BETA)" -M_DATE="040222" - -# Function to show about -function showAbout() { - /usr/bin/zenity --title "About" --info --width=330 \ - --text "Software: ks-zui (ks-tools) ${VERSION} \ - (${M_DATE})\nAuthor: q3aql\nContact: q3aql@protonmail.ch\nLicense: GPL v2.0" -} - -# Function to show information of video file -# Sintax: showVideoInfo -function showVideoInfo() { - videoFile=$(/usr/bin/zenity --title "ks-zui (ks-tools) ${VERSION} (${M_DATE}) \ - | Select the video file" --file-selection) - # Enable in Cygwin - videoFile=$(cygwin-path -c "${videoFile}") - ks-mp4-wrapper --show-info "${videoFile}" - echo -n "Press ENTER to continue " ; read null -} - -# Function to convert MP4 with subs -# Sintax: convertMP4WithSub -function convertMP4WithSub() { - videoFile=$(/usr/bin/zenity --title "ks-zui (ks-tools) ${VERSION} (${M_DATE}) \ - | Select the video file" --file-selection) - # Enable in Cygwin - videoFile=$(cygwin-path -c "${videoFile}") - # Detect configuration - if [ -z "${videoFile}" ] ; then - echo null > /dev/null - else - videoTrackDefault=$(ks-mp4-wrapper --show-video-default "${videoFile}") - audioTrackDefault=$(ks-mp4-wrapper --show-audio-default "${videoFile}") - subtitleTrackDefault=$(ks-mp4-wrapper --show-subtitle-default "${videoFile}") - resolutionDefault=$(ks-mp4-wrapper --show-resolution-default) - nameDefault=$(ks-mp4-wrapper --show-name-title-default "${videoFile}") - yearDefault=$(ks-mp4-wrapper --show-year-default) - genreDefault=$(ks-mp4-wrapper --show-genre-default) - # Ask the configuration - videoTrack=$(/usr/bin/zenity --entry --title "ks-zui (ks-tools) ${VERSION} (${M_DATE})" \ - --text "Enter the video track to map: " --entry-text "${videoTrackDefault}") - audioTrack=$(/usr/bin/zenity --entry --title "ks-zui (ks-tools) ${VERSION} (${M_DATE})" \ - --text "Enter the audio track to map: " --entry-text "${audioTrackDefault}") - subtitleTrack=$(/usr/bin/zenity --entry --title "ks-zui (ks-tools) ${VERSION} (${M_DATE})" \ - --text "Enter the subtitle track to map: " --entry-text "${subtitleTrackDefault}") - resolution=$(/usr/bin/zenity --entry --title "ks-zui (ks-tools) ${VERSION} (${M_DATE})" \ - --text "Enter the resolution: " --entry-text "${resolutionDefault}") - nameVideo=$(/usr/bin/zenity --entry --title "ks-zui (ks-tools) ${VERSION} (${M_DATE})" \ - --text "[METADATA] Enter the name title: " --entry-text "${nameDefault}") - yearVideo=$(/usr/bin/zenity --entry --title "ks-zui (ks-tools) ${VERSION} (${M_DATE})" \ - --text "[METADATA] Enter the year: " --entry-text "${yearDefault}") - genreVideo=$(/usr/bin/zenity --entry --title "ks-zui (ks-tools) ${VERSION} (${M_DATE})" \ - --text "[METADATA] Enter the genre: " --entry-text "${genreDefault}") - # Disable on Cygwin - #mkdir -p ${HOME}/Conv - #outputFile=$(/usr/bin/zenity --entry --title "ks-zui (ks-tools) ${VERSION} (${M_DATE})" \ - #--text "Enter the path of ouput file prefix: " --entry-text "${HOME}/Conv/Default") - # Enable on Cygwin - mkdir -p /cygdrive/c/Conv - outputFile=$(/usr/bin/zenity --entry --title "ks-zui (ks-tools) ${VERSION} (${M_DATE})" \ - --text "Enter the path of ouput file prefix: " --entry-text "/cygdrive/c/Conv/Default") - /usr/bin/zenity --question --title "ks-zui (ks-tools) ${VERSION} (${M_DATE})" --cancel-label="No" \ - --ok-label="Yes" --width=320 --text "Do you want apply '-thread_queue_size 2048' patch?" - outputPath=$? - if [ ${outputPath} -eq 0 ] ; then - ks-mp4-wrapper --conv-with-sub "${videoFile}" "${outputFile}" ${videoTrack} ${audioTrack} \ - ${subtitleTrack} ${resolution} "${nameVideo}" ${yearVideo} ${genreVideo} patch - else - ks-mp4-wrapper --conv-with-sub "${videoFile}" "${outputFile}" ${videoTrack} ${audioTrack} \ - ${subtitleTrack} ${resolution} "${nameVideo}" ${yearVideo} ${genreVideo} - fi - echo "" - echo -n "Press ENTER to continue " ; read null - fi -} - -# Function to convert MP4 -# Sintax: convertMP4 -function convertMP4() { - videoFile=$(/usr/bin/zenity --title "ks-zui (ks-tools) ${VERSION} (${M_DATE}) \ - | Select the video file" --file-selection) - # Enable in Cygwin - videoFile=$(cygwin-path -c "${videoFile}") - # Detect configuration - if [ -z "${videoFile}" ] ; then - echo null > /dev/null - else - videoTrackDefault=$(ks-mp4-wrapper --show-video-default "${videoFile}") - audioTrackDefault=$(ks-mp4-wrapper --show-audio-default "${videoFile}") - resolutionDefault=$(ks-mp4-wrapper --show-resolution-default) - nameDefault=$(ks-mp4-wrapper --show-name-title-default "${videoFile}") - yearDefault=$(ks-mp4-wrapper --show-year-default) - genreDefault=$(ks-mp4-wrapper --show-genre-default) - # Ask the configuration - videoTrack=$(/usr/bin/zenity --entry --title "ks-zui (ks-tools) ${VERSION} (${M_DATE})" \ - --text "Enter the video track to map: " --entry-text "${videoTrackDefault}") - audioTrack=$(/usr/bin/zenity --entry --title "ks-zui (ks-tools) ${VERSION} (${M_DATE})" \ - --text "Enter the audio track to map: " --entry-text "${audioTrackDefault}") - resolution=$(/usr/bin/zenity --entry --title "ks-zui (ks-tools) ${VERSION} (${M_DATE})" \ - --text "Enter the resolution: " --entry-text "${resolutionDefault}") - nameVideo=$(/usr/bin/zenity --entry --title "ks-zui (ks-tools) ${VERSION} (${M_DATE})" \ - --text "[METADATA] Enter the name title: " --entry-text "${nameDefault}") - yearVideo=$(/usr/bin/zenity --entry --title "ks-zui (ks-tools) ${VERSION} (${M_DATE})" \ - --text "[METADATA] Enter the year: " --entry-text "${yearDefault}") - genreVideo=$(/usr/bin/zenity --entry --title "ks-zui (ks-tools) ${VERSION} (${M_DATE})" \ - --text "[METADATA] Enter the genre: " --entry-text "${genreDefault}") - # Disable on Cygwin - #mkdir -p ${HOME}/Conv - #outputFile=$(/usr/bin/zenity --entry --title "ks-zui (ks-tools) ${VERSION} (${M_DATE})" \ - #--text "Enter the path of ouput file prefix: " --entry-text "${HOME}/Conv/Default") - # Enable on Cygwin - mkdir -p /cygdrive/c/Conv - outputFile=$(/usr/bin/zenity --entry --title "ks-zui (ks-tools) ${VERSION} (${M_DATE})" \ - --text "Enter the path of ouput file prefix: " --entry-text "/cygdrive/c/Conv/Default") - /usr/bin/zenity --question --title "ks-zui (ks-tools) ${VERSION} (${M_DATE})" --cancel-label="No" \ - --ok-label="Yes" --width=320 --text "Do you want apply '-thread_queue_size 2048' patch?" - outputPath=$? - if [ ${outputPath} -eq 0 ] ; then - ks-mp4-wrapper --conv "${videoFile}" "${outputFile}" ${videoTrack} \ - ${audioTrack} ${resolution} "${nameVideo}" ${yearVideo} ${genreVideo} patch - else - ks-mp4-wrapper --conv "${videoFile}" "${outputFile}" ${videoTrack} \ - ${audioTrack} ${resolution} "${nameVideo}" ${yearVideo} ${genreVideo} - fi - echo "" - echo -n "Press ENTER to continue " ; read null - fi -} - -# Function to convert AVI with subs -# Sintax: convertAVIWithSub -function convertAVIWithSub() { - videoFile=$(/usr/bin/zenity --title "ks-zui (ks-tools) ${VERSION} (${M_DATE}) \ - | Select the video file" --file-selection) - # Enable in Cygwin - videoFile=$(cygwin-path -c "${videoFile}") - # Detect configuration - if [ -z "${videoFile}" ] ; then - echo null > /dev/null - else - videoTrackDefault=$(ks-avi-wrapper --show-video-default "${videoFile}") - audioTrackDefault=$(ks-avi-wrapper --show-audio-default "${videoFile}") - subtitleTrackDefault=$(ks-avi-wrapper --show-subtitle-default "${videoFile}") - resolutionDefault=$(ks-avi-wrapper --show-resolution-default) - nameDefault=$(ks-avi-wrapper --show-name-title-default "${videoFile}") - yearDefault=$(ks-avi-wrapper --show-year-default) - genreDefault=$(ks-avi-wrapper --show-genre-default) - # Ask the configuration - videoTrack=$(/usr/bin/zenity --entry --title "ks-zui (ks-tools) ${VERSION} (${M_DATE})" \ - --text "Enter the video track to map: " --entry-text "${videoTrackDefault}") - audioTrack=$(/usr/bin/zenity --entry --title "ks-zui (ks-tools) ${VERSION} (${M_DATE})" \ - --text "Enter the audio track to map: " --entry-text "${audioTrackDefault}") - subtitleTrack=$(/usr/bin/zenity --entry --title "ks-zui (ks-tools) ${VERSION} (${M_DATE})" \ - --text "Enter the subtitle track to map: " --entry-text "${subtitleTrackDefault}") - resolution=$(/usr/bin/zenity --entry --title "ks-zui (ks-tools) ${VERSION} (${M_DATE})" \ - --text "Enter the resolution: " --entry-text "${resolutionDefault}") - nameVideo=$(/usr/bin/zenity --entry --title "ks-zui (ks-tools) ${VERSION} (${M_DATE})" \ - --text "[METADATA] Enter the name title: " --entry-text "${nameDefault}") - yearVideo=$(/usr/bin/zenity --entry --title "ks-zui (ks-tools) ${VERSION} (${M_DATE})" \ - --text "[METADATA] Enter the year: " --entry-text "${yearDefault}") - genreVideo=$(/usr/bin/zenity --entry --title "ks-zui (ks-tools) ${VERSION} (${M_DATE})" \ - --text "[METADATA] Enter the genre: " --entry-text "${genreDefault}") - # Disable on Cygwin - #mkdir -p ${HOME}/Conv - #outputFile=$(/usr/bin/zenity --entry --title "ks-zui (ks-tools) ${VERSION} (${M_DATE})" \ - #--text "Enter the path of ouput file prefix: " --entry-text "${HOME}/Conv/Default") - # Enable on Cygwin - mkdir -p /cygdrive/c/Conv - outputFile=$(/usr/bin/zenity --entry --title "ks-zui (ks-tools) ${VERSION} (${M_DATE})" \ - --text "Enter the path of ouput file prefix: " --entry-text "/cygdrive/c/Conv/Default") - /usr/bin/zenity --question --title "ks-zui (ks-tools) ${VERSION} (${M_DATE})" --cancel-label="No" \ - --ok-label="Yes" --width=320 --text "Do you want apply '-thread_queue_size 2048' patch?" - outputPath=$? - if [ ${outputPath} -eq 0 ] ; then - ks-avi-wrapper --conv-with-sub "${videoFile}" "${outputFile}" ${videoTrack} ${audioTrack} \ - ${subtitleTrack} ${resolution} "${nameVideo}" ${yearVideo} ${genreVideo} patch - else - ks-avi-wrapper --conv-with-sub "${videoFile}" "${outputFile}" ${videoTrack} ${audioTrack} \ - ${subtitleTrack} ${resolution} "${nameVideo}" ${yearVideo} ${genreVideo} - fi - echo "" - echo -n "Press ENTER to continue " ; read null - fi -} - -# Function to convert AVI -# Sintax: convertAVIW -function convertAVI() { - videoFile=$(/usr/bin/zenity --title "ks-zui (ks-tools) ${VERSION} (${M_DATE}) \ - | Select the video file" --file-selection) - # Enable in Cygwin - videoFile=$(cygwin-path -c "${videoFile}") - # Detect configuration - if [ -z "${videoFile}" ] ; then - echo null > /dev/null - else - videoTrackDefault=$(ks-avi-wrapper --show-video-default "${videoFile}") - audioTrackDefault=$(ks-avi-wrapper --show-audio-default "${videoFile}") - resolutionDefault=$(ks-avi-wrapper --show-resolution-default) - nameDefault=$(ks-avi-wrapper --show-name-title-default "${videoFile}") - yearDefault=$(ks-avi-wrapper --show-year-default) - genreDefault=$(ks-avi-wrapper --show-genre-default) - # Ask the configuration - videoTrack=$(/usr/bin/zenity --entry --title "ks-zui (ks-tools) ${VERSION} (${M_DATE})" \ - --text "Enter the video track to map: " --entry-text "${videoTrackDefault}") - audioTrack=$(/usr/bin/zenity --entry --title "ks-zui (ks-tools) ${VERSION} (${M_DATE})" \ - --text "Enter the audio track to map: " --entry-text "${audioTrackDefault}") - resolution=$(/usr/bin/zenity --entry --title "ks-zui (ks-tools) ${VERSION} (${M_DATE})" \ - --text "Enter the resolution: " --entry-text "${resolutionDefault}") - nameVideo=$(/usr/bin/zenity --entry --title "ks-zui (ks-tools) ${VERSION} (${M_DATE})" \ - --text "[METADATA] Enter the name title: " --entry-text "${nameDefault}") - yearVideo=$(/usr/bin/zenity --entry --title "ks-zui (ks-tools) ${VERSION} (${M_DATE})" \ - --text "[METADATA] Enter the year: " --entry-text "${yearDefault}") - genreVideo=$(/usr/bin/zenity --entry --title "ks-zui (ks-tools) ${VERSION} (${M_DATE})" \ - --text "[METADATA] Enter the genre: " --entry-text "${genreDefault}") - # Disable on Cygwin - #mkdir -p ${HOME}/Conv - #outputFile=$(/usr/bin/zenity --entry --title "ks-zui (ks-tools) ${VERSION} (${M_DATE})" \ - #--text "Enter the path of ouput file prefix: " --entry-text "${HOME}/Conv/Default") - # Enable on Cygwin - mkdir -p /cygdrive/c/Conv - outputFile=$(/usr/bin/zenity --entry --title "ks-zui (ks-tools) ${VERSION} (${M_DATE})" \ - --text "Enter the path of ouput file prefix: " --entry-text "/cygdrive/c/Conv/Default") - /usr/bin/zenity --question --title "ks-zui (ks-tools) ${VERSION} (${M_DATE})" --cancel-label="No" \ - --ok-label="Yes" --width=320 --text "Do you want apply '-thread_queue_size 2048' patch?" - outputPath=$? - if [ ${outputPath} -eq 0 ] ; then - ks-avi-wrapper --conv "${videoFile}" "${outputFile}" ${videoTrack} \ - ${audioTrack} ${resolution} "${nameVideo}" ${yearVideo} ${genreVideo} patch - else - ks-avi-wrapper --conv "${videoFile}" "${outputFile}" ${videoTrack} \ - ${audioTrack} ${resolution} "${nameVideo}" ${yearVideo} ${genreVideo} - fi - echo "" - echo -n "Press ENTER to continue " ; read null - fi -} - -# Function to convert VOB -# Sintax: convertVOB -function convertVOB() { - videoFile=$(/usr/bin/zenity --title "ks-zui (ks-tools) ${VERSION} (${M_DATE}) \ - | Select the video file" --file-selection) - # Enable in Cygwin - videoFile=$(cygwin-path -c "${videoFile}") - # Detect configuration - if [ -z "${videoFile}" ] ; then - echo null > /dev/null - else - videoTrackDefault=$(ks-vob-wrapper --show-video-default "${videoFile}") - audioTrackDefault=$(ks-vob-wrapper --show-audio-default "${videoFile}") - resolutionDefault=$(ks-vob-wrapper --show-resolution-default) - # Ask the configuration - videoTrack=$(/usr/bin/zenity --entry --title "ks-zui (ks-tools) ${VERSION} (${M_DATE})" \ - --text "Enter the video track to map: " --entry-text "${videoTrackDefault}") - audioTrack=$(/usr/bin/zenity --entry --title "ks-zui (ks-tools) ${VERSION} (${M_DATE})" \ - --text "Enter the audio track to map: " --entry-text "${audioTrackDefault}") - resolution=$(/usr/bin/zenity --entry --title "ks-zui (ks-tools) ${VERSION} (${M_DATE})" \ - --text "Enter the resolution: " --entry-text "${resolutionDefault}") - # Disable on Cygwin - #mkdir -p ${HOME}/Conv - #outputFile=$(/usr/bin/zenity --entry --title "ks-zui (ks-tools) ${VERSION} (${M_DATE})" \ - #--text "Enter the path of ouput file prefix: " --entry-text "${HOME}/Conv/Default") - # Enable on Cygwin - mkdir -p /cygdrive/c/Conv - outputFile=$(/usr/bin/zenity --entry --title "ks-zui (ks-tools) ${VERSION} (${M_DATE})" \ - --text "Enter the path of ouput file prefix: " --entry-text "/cygdrive/c/Conv/Default") - /usr/bin/zenity --question --title "ks-zui (ks-tools) ${VERSION} (${M_DATE})" --cancel-label="No" \ - --ok-label="Yes" --width=320 --text "Do you want apply '-thread_queue_size 2048' patch?" - outputPath=$? - if [ ${outputPath} -eq 0 ] ; then - ks-vob-wrapper --conv "${videoFile}" "${outputFile}" ${videoTrack} \ - ${audioTrack} ${resolution} patch - else - ks-vob-wrapper --conv "${videoFile}" "${outputFile}" ${videoTrack} \ - ${audioTrack} ${resolution} "${nameVideo}" ${yearVideo} ${genreVideo} - fi - echo "" - echo -n "Press ENTER to continue " ; read null - fi -} - -# Choose subtitles in MP4 convert -function subtitlesMP4() { - /usr/bin/zenity --question --title "ks-zui (ks-tools) ${VERSION} (${M_DATE})" --cancel-label="No" \ - --ok-label="Yes" --width=320 --text "Do you want enable subtitles?" - outputPath=$? - if [ ${outputPath} -eq 0 ] ; then - convertMP4WithSub - else - convertMP4 - fi -} - -# Choose subtitles in AVI convert -function subtitlesAVI() { - /usr/bin/zenity --question --title "ks-zui (ks-tools) ${VERSION} (${M_DATE})" --cancel-label="No" \ - --ok-label="Yes" --width=320 --text "Do you want enable subtitles?" - outputPath=$? - if [ ${outputPath} -eq 0 ] ; then - convertAVIWithSub - else - convertAVI - fi -} - -# Show main menu -echo "" -echo "* Starting ks-zui (ks-tools) ${VERSION} (${M_DATE})" -echo "" -showMenu=0 -while [ ${showMenu} -eq 0 ] ; do - clear - opcion=$(/usr/bin/zenity --width=420 --height=560 --list --title "ks-zui (ks-tools) ${VERSION} ($M_DATE)" \ - --column "Available options:" "### CONVERSION OPTIONS ###" "Show video file information" \ - "Convert video file to MP4" "Convert video file to AVI" "Convert video file to VOB" \ - "########################" "### UPLOAD OPTIONS ###" "Upload videos file(s) to server" \ - "Upload audio file(s) to server" "Upload common file(s) to server" "Upload recursively file(s) to server"\ - "Remove configuration" "Show configuration" "Edit configuration" \ - "About" "Exit") - opcion=$(echo ${opcion} | cut -d "|" -f 1) - # opcion=$(echo ${opcion} | cut -d "|" -f 1) - echo ${opcion} - if [ "${opcion}" == "### CONVERSION OPTIONS ###" ] ; then - echo null > /dev/null - elif [ "${opcion}" == "Show video file information" ] ; then - showVideoInfo - elif [ "${opcion}" == "Convert video file to MP4" ] ; then - subtitlesMP4 - elif [ "${opcion}" == "Convert video file to AVI" ] ; then - subtitlesAVI - elif [ "${opcion}" == "Convert video file to VOB" ] ; then - convertVOB - elif [ "${opcion}" == "########################" ] ; then - echo null > /dev/null - elif [ "${opcion}" == "### UPLOAD OPTIONS ###" ] ; then - echo null > /dev/null - elif [ "${opcion}" == "Upload videos file(s) to server" ] ; then - ks-upv -i - /usr/bin/zenity --title "ks-zui (ks-tools) ${VERSION} (${M_DATE})" --info --width=300 \ - --text "File(s) upload is complete!" - elif [ "${opcion}" == "Upload audio file(s) to server" ] ; then - ks-upa -i - /usr/bin/zenity --title "ks-zui (ks-tools) ${VERSION} (${M_DATE})" --info --width=300 \ - --text "File(s) upload is complete!" - elif [ "${opcion}" == "Upload common file(s) to server" ] ; then - ks-upf -i - /usr/bin/zenity --title "ks-zui (ks-tools) ${VERSION} (${M_DATE})" --info --width=300 \ - --text "File(s) upload is complete!" - elif [ "${opcion}" == "Upload recursively file(s) to server" ] ; then - ks-upr -i - /usr/bin/zenity --title "ks-zui (ks-tools) ${VERSION} (${M_DATE})" --info --width=300 \ - --text "File(s) upload is complete!" - elif [ "${opcion}" == "Remove configuration" ] ; then - ks-upf -r - /usr/bin/zenity --title "ks-zui (ks-tools) ${VERSION} (${M_DATE})" --info --width=300 \ - --text "The configuration has been removed!" - elif [ "${opcion}" == "Show configuration" ] ; then - ks-upf -c - echo -n "Press ENTER to continue " ; read null - elif [ "${opcion}" == "Edit configuration" ] ; then - ks-upf -e - elif [ "${opcion}" == "About" ] ; then - showAbout - elif [ "${opcion}" == "Exit" ] ; then - showMenu=1 - else - /usr/bin/zenity --title "ks-zui (ks-tools) ${VERSION} (${M_DATE})" --warning --width=300 \ - --text "Choose one of the menu options" - fi -done diff --git a/cygwin/tmp/tmp-files-here b/cygwin/tmp/tmp-files-here deleted file mode 100644 index e69de29..0000000 diff --git a/cygwin/usr/share/bash-completion/completions/blkid b/cygwin/usr/share/bash-completion/completions/blkid deleted file mode 100644 index 57b34c3..0000000 --- a/cygwin/usr/share/bash-completion/completions/blkid +++ /dev/null @@ -1,98 +0,0 @@ -_blkid_module() -{ - local cur prev OPTS OUTPUT_ALL - OUTPUT_ALL='' - COMPREPLY=() - cur="${COMP_WORDS[COMP_CWORD]}" - prev="${COMP_WORDS[COMP_CWORD-1]}" - case $prev in - '-c'|'--cache-file') - local IFS=$'\n' - compopt -o filenames - COMPREPLY=( $(compgen -f -- $cur) ) - return 0 - ;; - '-o'|'--output') - COMPREPLY=( $(compgen -W "value device export full" -- $cur) ) - return 0 - ;; - '-s'|'--match-tag') - COMPREPLY=( $(compgen -W "tag" -- $cur) ) - return 0 - ;; - '-t'|'--match-token') - COMPREPLY=( $(compgen -W "TYPE= LABEL= UUID=" -- $cur) ) - return 0 - ;; - '-L'|'--label') - COMPREPLY=( $(compgen -W "$(cd /dev/disk/by-label/ 2>/dev/null && echo *)" -- $cur) ) - return 0 - ;; - '-U'|'--uuid') - COMPREPLY=( $(compgen -W "$(cd /dev/disk/by-uuid/ 2>/dev/null && echo *)" -- $cur) ) - return 0 - ;; - '-S'|'--size') - COMPREPLY=( $(compgen -W "size" -- $cur) ) - return 0 - ;; - '-O'|'--offset') - COMPREPLY=( $(compgen -W "offset" -- $cur) ) - return 0 - ;; - '-u'|'--usages') - OUTPUT_ALL={,no}{filesystem,raid,crypto,other} - ;; - '-n'|'--match-types') - OUTPUT_ALL=" - $(awk '{print $NF}' /proc/filesystems) - $(\ls /lib/modules/$(uname -r)/kernel/fs) - " - ;; - '-h'|'--help'|'-V'|'--version') - return 0 - ;; - esac - if [ -n "$OUTPUT_ALL" ]; then - local prefix realcur OUTPUT_ALL OUTPUT - realcur="${cur##*,}" - prefix="${cur%$realcur}" - for WORD in $OUTPUT_ALL; do - if ! [[ $prefix == *"$WORD"* ]]; then - OUTPUT="$WORD ${OUTPUT:-""}" - fi - done - compopt -o nospace - COMPREPLY=( $(compgen -P "$prefix" -W "$OUTPUT" -S ',' -- "$realcur") ) - return 0 - fi - case $cur in - -*) - OPTS=" - --cache-file - --no-encoding - --garbage-collect - --output - --list-filesystems - --match-tag - --match-token - --list-one - --label - --uuid - --probe - --info - --size - --offset - --usages - --match-types - --help - --version - " - COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) - return 0 - ;; - esac - COMPREPLY=( $(compgen -W "$(lsblk -pnro name)" -- $cur) ) - return 0 -} -complete -F _blkid_module blkid diff --git a/cygwin/usr/share/bash-completion/completions/cal b/cygwin/usr/share/bash-completion/completions/cal deleted file mode 100644 index e627bdb..0000000 --- a/cygwin/usr/share/bash-completion/completions/cal +++ /dev/null @@ -1,29 +0,0 @@ -_cal_module() -{ - local cur prev OPTS - COMPREPLY=() - cur="${COMP_WORDS[COMP_CWORD]}" - case $cur in - -*) - OPTS=" --one - --three - --months - --sunday - --span - --monday - --julian - --year - --twelve - --week - --color=auto - --color=always - --color=never - --version - --help" - COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) - return 0 - ;; - esac - return 0 -} -complete -F _cal_module cal diff --git a/cygwin/usr/share/bash-completion/completions/cfdisk b/cygwin/usr/share/bash-completion/completions/cfdisk deleted file mode 100644 index 8921fa3..0000000 --- a/cygwin/usr/share/bash-completion/completions/cfdisk +++ /dev/null @@ -1,29 +0,0 @@ -_cfdisk_module() -{ - local cur prev OPTS - COMPREPLY=() - cur="${COMP_WORDS[COMP_CWORD]}" - prev="${COMP_WORDS[COMP_CWORD-1]}" - case $prev in - '-L'|'--color') - COMPREPLY=( $(compgen -W "auto never always" -- $cur) ) - return 0 - ;; - '-V'|'--version'|'h'|'--help') - return 0 - ;; - esac - case $cur in - -*) - OPTS=" --color - --zero - --help - --version" - COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) - return 0 - ;; - esac - COMPREPLY=( $(compgen -W "$(lsblk -pnro name)" -- $cur) ) - return 0 -} -complete -F _cfdisk_module cfdisk diff --git a/cygwin/usr/share/bash-completion/completions/col b/cygwin/usr/share/bash-completion/completions/col deleted file mode 100644 index cea57b5..0000000 --- a/cygwin/usr/share/bash-completion/completions/col +++ /dev/null @@ -1,27 +0,0 @@ -_col_module() -{ - local cur prev OPTS - COMPREPLY=() - cur="${COMP_WORDS[COMP_CWORD]}" - prev="${COMP_WORDS[COMP_CWORD-1]}" - case $prev in - '-l'|'--lines') - COMPREPLY=( $(compgen -W "number" -- $cur) ) - return 0 - ;; - '-H'|'--help'|'-V'|'--version') - return 0 - ;; - esac - OPTS="--no-backspaces - --fine - --pass - --tabs - --spaces - --lines - --version - --help" - COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) - return 0 -} -complete -F _col_module col diff --git a/cygwin/usr/share/bash-completion/completions/colcrt b/cygwin/usr/share/bash-completion/completions/colcrt deleted file mode 100644 index c66d7e6..0000000 --- a/cygwin/usr/share/bash-completion/completions/colcrt +++ /dev/null @@ -1,27 +0,0 @@ -_colcrt_module() -{ - local cur prev OPTS - COMPREPLY=() - cur="${COMP_WORDS[COMP_CWORD]}" - prev="${COMP_WORDS[COMP_CWORD-1]}" - case $prev in - '-h'|'--help'|'-V'|'--version') - return 0 - ;; - esac - case $cur in - -*) - OPTS=" --no-underlining - --half-lines - --version - --help" - COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) - return 0 - ;; - esac - local IFS=$'\n' - compopt -o filenames - COMPREPLY=( $(compgen -f -- $cur) ) - return 0 -} -complete -F _colcrt_module colcrt diff --git a/cygwin/usr/share/bash-completion/completions/colrm b/cygwin/usr/share/bash-completion/completions/colrm deleted file mode 100644 index 622dbaa..0000000 --- a/cygwin/usr/share/bash-completion/completions/colrm +++ /dev/null @@ -1,29 +0,0 @@ -_colrm_module() -{ - local cur prev OPTS - COMPREPLY=() - cur="${COMP_WORDS[COMP_CWORD]}" - prev="${COMP_WORDS[COMP_CWORD-1]}" - case $prev in - '-h'|'--help'|'-V'|'--version') - return 0 - ;; - esac - case $cur in - -*) - OPTS="--version --help" - COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) - return 0 - ;; - esac - case $COMP_CWORD in - 1) - COMPREPLY=( $(compgen -W "startcol" -- $cur) ) - ;; - 2) - COMPREPLY=( $(compgen -W "endcol" -- $cur) ) - ;; - esac - return 0 -} -complete -F _colrm_module colrm diff --git a/cygwin/usr/share/bash-completion/completions/column b/cygwin/usr/share/bash-completion/completions/column deleted file mode 100644 index c5a998b..0000000 --- a/cygwin/usr/share/bash-completion/completions/column +++ /dev/null @@ -1,62 +0,0 @@ -_column_module() -{ - local cur prev OPTS - COMPREPLY=() - cur="${COMP_WORDS[COMP_CWORD]}" - prev="${COMP_WORDS[COMP_CWORD-1]}" - case $prev in - '-c'|'--output-width') - COMPREPLY=( $(compgen -W "number" -- $cur) ) - return 0 - ;; - '-s'|'--separator'|'-o'|'--output-separator'|'-n'|'--table-name'|'-O') - COMPREPLY=( $(compgen -W "string" -- $cur) ) - return 0 - ;; - '-O'|'--table-order'|'-N'|'--table-columns'|'-E'|'--table-noextreme'|'-H'|'--table-hide'|'-R'|'--table-right'|'-T'|'--table-truncate'|'-W'|'--table-wrap') - COMPREPLY=( $(compgen -W "string" -- $cur) ) - return 0 - ;; - '-r'|'--tree'|'-i'|'--tree-id'|'-p'|'--tree-parent') - COMPREPLY=( $(compgen -W "string" -- $cur) ) - return 0 - ;; - '-h'|'--help'|'-V'|'--version') - return 0 - ;; - esac - case $cur in - -*) - OPTS="--columns - --table - --table-name - --table-order - --table-columns - --table-noextreme - --table-noheadings - --table-header-repeat - --table-hide - --table-right - --table-truncate - --table-wrap - --table-empty-lines - --json - --tree - --tree-id - --tree-parent - --output-width - --separator - --output-separator - --fillrows - --help - --version" - COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) - return 0 - ;; - esac - local IFS=$'\n' - compopt -o filenames - COMPREPLY=( $(compgen -f -- $cur) ) - return 0 -} -complete -F _column_module column diff --git a/cygwin/usr/share/bash-completion/completions/fdisk b/cygwin/usr/share/bash-completion/completions/fdisk deleted file mode 100644 index 855de14..0000000 --- a/cygwin/usr/share/bash-completion/completions/fdisk +++ /dev/null @@ -1,97 +0,0 @@ -_fdisk_module() -{ - local cur prev OPTS - COMPREPLY=() - cur="${COMP_WORDS[COMP_CWORD]}" - prev="${COMP_WORDS[COMP_CWORD-1]}" - case $prev in - '-s'|'--getsz') - COMPREPLY=( $(compgen -W "$(lsblk -pnro name)" -- $cur) ) - return 0 - ;; - '-b'|'--sector-size') - COMPREPLY=( $(compgen -W "512 1024 2048 4096" -- $cur) ) - return 0 - ;; - '-c'|'--compatibility') - COMPREPLY=( $(compgen -W "dos nondos" -- $cur) ) - return 0 - ;; - '-L'|'--color') - COMPREPLY=( $(compgen -W "auto never always" -- $cur) ) - return 0 - ;; - '--output') - local prefix realcur OUTPUT_ALL OUTPUT - realcur="${cur##*,}" - prefix="${cur%$realcur}" - OUTPUT_ALL=" - Attrs - Boot - Bsize - Cpg - Cylinders - Device - End - End-C/H/S - Flags - Fsize - Id - Name - Sectors - Size - Slice - Start - Start-C/H/S - Type - Type-UUID - UUID - " - for WORD in $OUTPUT_ALL; do - if ! [[ $prefix == *"$WORD"* ]]; then - OUTPUT="$WORD ${OUTPUT:-""}" - fi - done - compopt -o nospace - COMPREPLY=( $(compgen -P "$prefix" -W "$OUTPUT" -S ',' -- "$realcur") ) - return 0 - ;; - '-u'|'--units') - COMPREPLY=( $(compgen -W "cylinders sectors" -- $cur) ) - return 0 - ;; - '-C'|'--cylinders'|'-H'|'--heads'|'-S'|'--sectors') - COMPREPLY=( $(compgen -W "number" -- $cur) ) - return 0 - ;; - '-h'|'--help'|'-v'|'--version'|'-V'|'--list') - return 0 - ;; - esac - case $cur in - -*) - OPTS="--sector-size - --protect-boot - --compatibility - --color - --list - --output - --type - --units - --getsz - --bytes - --wipe - --wipe-partitions - --cylinders - --heads - --sectors - --help - --version" - COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) - return 0 - ;; - esac - COMPREPLY=( $(compgen -W "$(lsblk -pnro name)" -- $cur) ) - return 0 -} -complete -F _fdisk_module fdisk diff --git a/cygwin/usr/share/bash-completion/completions/findfs b/cygwin/usr/share/bash-completion/completions/findfs deleted file mode 100644 index 5297b86..0000000 --- a/cygwin/usr/share/bash-completion/completions/findfs +++ /dev/null @@ -1,34 +0,0 @@ -_findfs_module() -{ - local cur prev OPTS findable - COMPREPLY=() - cur="${COMP_WORDS[COMP_CWORD]}" - prev="${COMP_WORDS[COMP_CWORD-1]}" - case $prev in - '-h'|'--help'|'-V'|'--version') - return 0 - ;; - esac - case $cur in - -*) - OPTS="--version --help" - COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) - return 0 - ;; - esac - for i in $(lsblk -rpno label); do - findable+=" LABEL=$i" - done - for i in $(lsblk -rpno uuid); do - findable+=" UUID=$i" - done - for i in $(lsblk -rpno partlabel); do - findable+=" PARTLABEL=$i" - done - for i in $(lsblk -rpno partuuid); do - findable+=" PARTUUID=$i" - done - COMPREPLY=( $(compgen -W "$findable" -- $cur) ) - return 0 -} -complete -F _findfs_module findfs diff --git a/cygwin/usr/share/bash-completion/completions/flock b/cygwin/usr/share/bash-completion/completions/flock deleted file mode 100644 index cb68245..0000000 --- a/cygwin/usr/share/bash-completion/completions/flock +++ /dev/null @@ -1,47 +0,0 @@ -_flock_module() -{ - local cur prev OPTS - COMPREPLY=() - cur="${COMP_WORDS[COMP_CWORD]}" - prev="${COMP_WORDS[COMP_CWORD-1]}" - case $prev in - '-w'|'--timeout') - COMPREPLY=( $(compgen -W "seconds" -- $cur) ) - return 0 - ;; - '-E'|'--conflict-exit-code') - COMPREPLY=( $(compgen -W "{0..255}" -- $cur) ) - return 0 - ;; - '-c'|'--command') - compopt -o bashdefault - COMPREPLY=( $(compgen -c -- $cur) ) - return 0 - ;; - '-h'|'--help'|'-V'|'--version') - return 0 - ;; - esac - case $cur in - -*) - OPTS="--shared - --exclusive - --unlock - --nonblock - --timeout - --conflict-exit-code - --close - --command - --no-fork - --help - --version" - COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) - return 0 - ;; - esac - local IFS=$'\n' - compopt -o filenames - COMPREPLY=( $(compgen -f -- ${cur:-"/"}) ) - return 0 -} -complete -F _flock_module flock diff --git a/cygwin/usr/share/bash-completion/completions/fsck.cramfs b/cygwin/usr/share/bash-completion/completions/fsck.cramfs deleted file mode 100644 index d17d2fe..0000000 --- a/cygwin/usr/share/bash-completion/completions/fsck.cramfs +++ /dev/null @@ -1,33 +0,0 @@ -_fsck.cramfs_module() -{ - local cur prev OPTS - COMPREPLY=() - cur="${COMP_WORDS[COMP_CWORD]}" - prev="${COMP_WORDS[COMP_CWORD-1]}" - case $prev in - '-b'|'--blocksize') - COMPREPLY=( $(compgen -W "size" -- $cur) ) - return 0 - ;; - '--extract') - local IFS=$'\n' - compopt -o filenames - COMPREPLY=( $(compgen -o dirnames -- ${cur:-"/"}) ) - return 0 - ;; - '-h'|'--help'|'-V'|'--version') - return 0 - ;; - esac - case $cur in - -*) - COMPREPLY=( $(compgen -W "--verbose --blocksize --extract --help --version" -- $cur) ) - return 0 - ;; - esac - local IFS=$'\n' - compopt -o filenames - COMPREPLY=( $(compgen -f -- $cur) ) - return 0 -} -complete -F _fsck.cramfs_module fsck.cramfs diff --git a/cygwin/usr/share/bash-completion/completions/fsck.minix b/cygwin/usr/share/bash-completion/completions/fsck.minix deleted file mode 100644 index ac4571e..0000000 --- a/cygwin/usr/share/bash-completion/completions/fsck.minix +++ /dev/null @@ -1,16 +0,0 @@ -_fsck.minix_module() -{ - local cur OPTS - COMPREPLY=() - cur="${COMP_WORDS[COMP_CWORD]}" - case $cur in - -*) - OPTS="--list --auto --repair --verbose --super --uncleared --force --help --version" - COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) - return 0 - ;; - esac - COMPREPLY=( $(compgen -W "$(lsblk -pnro name)" -- $cur) ) - return 0 -} -complete -F _fsck.minix_module fsck.minix diff --git a/cygwin/usr/share/bash-completion/completions/getopt b/cygwin/usr/share/bash-completion/completions/getopt deleted file mode 100644 index 5e3fca6..0000000 --- a/cygwin/usr/share/bash-completion/completions/getopt +++ /dev/null @@ -1,37 +0,0 @@ -_getopt_module() -{ - local cur prev OPTS - COMPREPLY=() - cur="${COMP_WORDS[COMP_CWORD]}" - prev="${COMP_WORDS[COMP_CWORD-1]}" - case $prev in - '-l'|'--longoptions') - COMPREPLY=( $(compgen -W "longopts" -- $cur) ) - return 0 - ;; - '-n'|'--name') - COMPREPLY=( $(compgen -W "name" -- $cur) ) - return 0 - ;; - '-o'|'--options') - COMPREPLY=( $(compgen -W "optstring" -- $cur) ) - return 0 - ;; - '-s'|'--shell') - COMPREPLY=( $(compgen -W "sh bash csh tcsh" -- $cur) ) - return 0 - ;; - '-h'|'--help'|'-V'|'--version') - return 0 - ;; - esac - case $cur in - -*) - OPTS="--alternative --help --longoptions --name --options --quiet --quiet-output --shell --test --unquoted --version" - COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) - return 0 - ;; - esac - return 0 -} -complete -F _getopt_module getopt diff --git a/cygwin/usr/share/bash-completion/completions/git b/cygwin/usr/share/bash-completion/completions/git deleted file mode 100644 index 499e56f..0000000 --- a/cygwin/usr/share/bash-completion/completions/git +++ /dev/null @@ -1,3055 +0,0 @@ -# bash/zsh completion support for core Git. -# -# Copyright (C) 2006,2007 Shawn O. Pearce -# Conceptually based on gitcompletion (http://gitweb.hawaga.org.uk/). -# Distributed under the GNU General Public License, version 2.0. -# -# The contained completion routines provide support for completing: -# -# *) local and remote branch names -# *) local and remote tag names -# *) .git/remotes file names -# *) git 'subcommands' -# *) git email aliases for git-send-email -# *) tree paths within 'ref:path/to/file' expressions -# *) file paths within current working directory and index -# *) common --long-options -# -# To use these routines: -# -# 1) Copy this file to somewhere (e.g. ~/.git-completion.bash). -# 2) Add the following line to your .bashrc/.zshrc: -# source ~/.git-completion.bash -# 3) Consider changing your PS1 to also show the current branch, -# see git-prompt.sh for details. -# -# If you use complex aliases of form '!f() { ... }; f', you can use the null -# command ':' as the first command in the function body to declare the desired -# completion style. For example '!f() { : git commit ; ... }; f' will -# tell the completion to use commit completion. This also works with aliases -# of form "!sh -c '...'". For example, "!sh -c ': git commit ; ... '". -# -# Compatible with bash 3.2.57. -# -# You can set the following environment variables to influence the behavior of -# the completion routines: -# -# GIT_COMPLETION_CHECKOUT_NO_GUESS -# -# When set to "1", do not include "DWIM" suggestions in git-checkout -# completion (e.g., completing "foo" when "origin/foo" exists). - -case "$COMP_WORDBREAKS" in -*:*) : great ;; -*) COMP_WORDBREAKS="$COMP_WORDBREAKS:" -esac - -# Discovers the path to the git repository taking any '--git-dir=' and -# '-C ' options into account and stores it in the $__git_repo_path -# variable. -__git_find_repo_path () -{ - if [ -n "$__git_repo_path" ]; then - # we already know where it is - return - fi - - if [ -n "${__git_C_args-}" ]; then - __git_repo_path="$(git "${__git_C_args[@]}" \ - ${__git_dir:+--git-dir="$__git_dir"} \ - rev-parse --absolute-git-dir 2>/dev/null)" - elif [ -n "${__git_dir-}" ]; then - test -d "$__git_dir" && - __git_repo_path="$__git_dir" - elif [ -n "${GIT_DIR-}" ]; then - test -d "${GIT_DIR-}" && - __git_repo_path="$GIT_DIR" - elif [ -d .git ]; then - __git_repo_path=.git - else - __git_repo_path="$(git rev-parse --git-dir 2>/dev/null)" - fi -} - -# Deprecated: use __git_find_repo_path() and $__git_repo_path instead -# __gitdir accepts 0 or 1 arguments (i.e., location) -# returns location of .git repo -__gitdir () -{ - if [ -z "${1-}" ]; then - __git_find_repo_path || return 1 - echo "$__git_repo_path" - elif [ -d "$1/.git" ]; then - echo "$1/.git" - else - echo "$1" - fi -} - -# Runs git with all the options given as argument, respecting any -# '--git-dir=' and '-C ' options present on the command line -__git () -{ - git ${__git_C_args:+"${__git_C_args[@]}"} \ - ${__git_dir:+--git-dir="$__git_dir"} "$@" 2>/dev/null -} - -# Removes backslash escaping, single quotes and double quotes from a word, -# stores the result in the variable $dequoted_word. -# 1: The word to dequote. -__git_dequote () -{ - local rest="$1" len ch - - dequoted_word="" - - while test -n "$rest"; do - len=${#dequoted_word} - dequoted_word="$dequoted_word${rest%%[\\\'\"]*}" - rest="${rest:$((${#dequoted_word}-$len))}" - - case "${rest:0:1}" in - \\) - ch="${rest:1:1}" - case "$ch" in - $'\n') - ;; - *) - dequoted_word="$dequoted_word$ch" - ;; - esac - rest="${rest:2}" - ;; - \') - rest="${rest:1}" - len=${#dequoted_word} - dequoted_word="$dequoted_word${rest%%\'*}" - rest="${rest:$((${#dequoted_word}-$len+1))}" - ;; - \") - rest="${rest:1}" - while test -n "$rest" ; do - len=${#dequoted_word} - dequoted_word="$dequoted_word${rest%%[\\\"]*}" - rest="${rest:$((${#dequoted_word}-$len))}" - case "${rest:0:1}" in - \\) - ch="${rest:1:1}" - case "$ch" in - \"|\\|\$|\`) - dequoted_word="$dequoted_word$ch" - ;; - $'\n') - ;; - *) - dequoted_word="$dequoted_word\\$ch" - ;; - esac - rest="${rest:2}" - ;; - \") - rest="${rest:1}" - break - ;; - esac - done - ;; - esac - done -} - -# The following function is based on code from: -# -# bash_completion - programmable completion functions for bash 3.2+ -# -# Copyright © 2006-2008, Ian Macdonald -# © 2009-2010, Bash Completion Maintainers -# -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, see . -# -# The latest version of this software can be obtained here: -# -# http://bash-completion.alioth.debian.org/ -# -# RELEASE: 2.x - -# This function can be used to access a tokenized list of words -# on the command line: -# -# __git_reassemble_comp_words_by_ref '=:' -# if test "${words_[cword_-1]}" = -w -# then -# ... -# fi -# -# The argument should be a collection of characters from the list of -# word completion separators (COMP_WORDBREAKS) to treat as ordinary -# characters. -# -# This is roughly equivalent to going back in time and setting -# COMP_WORDBREAKS to exclude those characters. The intent is to -# make option types like --date= and : easy to -# recognize by treating each shell word as a single token. -# -# It is best not to set COMP_WORDBREAKS directly because the value is -# shared with other completion scripts. By the time the completion -# function gets called, COMP_WORDS has already been populated so local -# changes to COMP_WORDBREAKS have no effect. -# -# Output: words_, cword_, cur_. - -__git_reassemble_comp_words_by_ref() -{ - local exclude i j first - # Which word separators to exclude? - exclude="${1//[^$COMP_WORDBREAKS]}" - cword_=$COMP_CWORD - if [ -z "$exclude" ]; then - words_=("${COMP_WORDS[@]}") - return - fi - # List of word completion separators has shrunk; - # re-assemble words to complete. - for ((i=0, j=0; i < ${#COMP_WORDS[@]}; i++, j++)); do - # Append each nonempty word consisting of just - # word separator characters to the current word. - first=t - while - [ $i -gt 0 ] && - [ -n "${COMP_WORDS[$i]}" ] && - # word consists of excluded word separators - [ "${COMP_WORDS[$i]//[^$exclude]}" = "${COMP_WORDS[$i]}" ] - do - # Attach to the previous token, - # unless the previous token is the command name. - if [ $j -ge 2 ] && [ -n "$first" ]; then - ((j--)) - fi - first= - words_[$j]=${words_[j]}${COMP_WORDS[i]} - if [ $i = $COMP_CWORD ]; then - cword_=$j - fi - if (($i < ${#COMP_WORDS[@]} - 1)); then - ((i++)) - else - # Done. - return - fi - done - words_[$j]=${words_[j]}${COMP_WORDS[i]} - if [ $i = $COMP_CWORD ]; then - cword_=$j - fi - done -} - -if ! type _get_comp_words_by_ref >/dev/null 2>&1; then -_get_comp_words_by_ref () -{ - local exclude cur_ words_ cword_ - if [ "$1" = "-n" ]; then - exclude=$2 - shift 2 - fi - __git_reassemble_comp_words_by_ref "$exclude" - cur_=${words_[cword_]} - while [ $# -gt 0 ]; do - case "$1" in - cur) - cur=$cur_ - ;; - prev) - prev=${words_[$cword_-1]} - ;; - words) - words=("${words_[@]}") - ;; - cword) - cword=$cword_ - ;; - esac - shift - done -} -fi - -# Fills the COMPREPLY array with prefiltered words without any additional -# processing. -# Callers must take care of providing only words that match the current word -# to be completed and adding any prefix and/or suffix (trailing space!), if -# necessary. -# 1: List of newline-separated matching completion words, complete with -# prefix and suffix. -__gitcomp_direct () -{ - local IFS=$'\n' - - COMPREPLY=($1) -} - -__gitcompappend () -{ - local x i=${#COMPREPLY[@]} - for x in $1; do - if [[ "$x" == "$3"* ]]; then - COMPREPLY[i++]="$2$x$4" - fi - done -} - -__gitcompadd () -{ - COMPREPLY=() - __gitcompappend "$@" -} - -# Generates completion reply, appending a space to possible completion words, -# if necessary. -# It accepts 1 to 4 arguments: -# 1: List of possible completion words. -# 2: A prefix to be added to each possible completion word (optional). -# 3: Generate possible completion matches for this word (optional). -# 4: A suffix to be appended to each possible completion word (optional). -__gitcomp () -{ - local cur_="${3-$cur}" - - case "$cur_" in - --*=) - ;; - --no-*) - local c i=0 IFS=$' \t\n' - for c in $1; do - if [[ $c == "--" ]]; then - continue - fi - c="$c${4-}" - if [[ $c == "$cur_"* ]]; then - case $c in - --*=*|*.) ;; - *) c="$c " ;; - esac - COMPREPLY[i++]="${2-}$c" - fi - done - ;; - *) - local c i=0 IFS=$' \t\n' - for c in $1; do - if [[ $c == "--" ]]; then - c="--no-...${4-}" - if [[ $c == "$cur_"* ]]; then - COMPREPLY[i++]="${2-}$c " - fi - break - fi - c="$c${4-}" - if [[ $c == "$cur_"* ]]; then - case $c in - --*=*|*.) ;; - *) c="$c " ;; - esac - COMPREPLY[i++]="${2-}$c" - fi - done - ;; - esac -} - -# Clear the variables caching builtins' options when (re-)sourcing -# the completion script. -if [[ -n ${ZSH_VERSION-} ]]; then - unset $(set |sed -ne 's/^\(__gitcomp_builtin_[a-zA-Z0-9_][a-zA-Z0-9_]*\)=.*/\1/p') 2>/dev/null -else - unset $(compgen -v __gitcomp_builtin_) -fi - -# This function is equivalent to -# -# __gitcomp "$(git xxx --git-completion-helper) ..." -# -# except that the output is cached. Accept 1-3 arguments: -# 1: the git command to execute, this is also the cache key -# 2: extra options to be added on top (e.g. negative forms) -# 3: options to be excluded -__gitcomp_builtin () -{ - # spaces must be replaced with underscore for multi-word - # commands, e.g. "git remote add" becomes remote_add. - local cmd="$1" - local incl="$2" - local excl="$3" - - local var=__gitcomp_builtin_"${cmd/-/_}" - local options - eval "options=\$$var" - - if [ -z "$options" ]; then - # leading and trailing spaces are significant to make - # option removal work correctly. - options=" $incl $(__git ${cmd/_/ } --git-completion-helper) " - for i in $excl; do - options="${options/ $i / }" - done - eval "$var=\"$options\"" - fi - - __gitcomp "$options" -} - -# Variation of __gitcomp_nl () that appends to the existing list of -# completion candidates, COMPREPLY. -__gitcomp_nl_append () -{ - local IFS=$'\n' - __gitcompappend "$1" "${2-}" "${3-$cur}" "${4- }" -} - -# Generates completion reply from newline-separated possible completion words -# by appending a space to all of them. -# It accepts 1 to 4 arguments: -# 1: List of possible completion words, separated by a single newline. -# 2: A prefix to be added to each possible completion word (optional). -# 3: Generate possible completion matches for this word (optional). -# 4: A suffix to be appended to each possible completion word instead of -# the default space (optional). If specified but empty, nothing is -# appended. -__gitcomp_nl () -{ - COMPREPLY=() - __gitcomp_nl_append "$@" -} - -# Fills the COMPREPLY array with prefiltered paths without any additional -# processing. -# Callers must take care of providing only paths that match the current path -# to be completed and adding any prefix path components, if necessary. -# 1: List of newline-separated matching paths, complete with all prefix -# path components. -__gitcomp_file_direct () -{ - local IFS=$'\n' - - COMPREPLY=($1) - - # use a hack to enable file mode in bash < 4 - compopt -o filenames +o nospace 2>/dev/null || - compgen -f /non-existing-dir/ >/dev/null || - true -} - -# Generates completion reply with compgen from newline-separated possible -# completion filenames. -# It accepts 1 to 3 arguments: -# 1: List of possible completion filenames, separated by a single newline. -# 2: A directory prefix to be added to each possible completion filename -# (optional). -# 3: Generate possible completion matches for this word (optional). -__gitcomp_file () -{ - local IFS=$'\n' - - # XXX does not work when the directory prefix contains a tilde, - # since tilde expansion is not applied. - # This means that COMPREPLY will be empty and Bash default - # completion will be used. - __gitcompadd "$1" "${2-}" "${3-$cur}" "" - - # use a hack to enable file mode in bash < 4 - compopt -o filenames +o nospace 2>/dev/null || - compgen -f /non-existing-dir/ >/dev/null || - true -} - -# Execute 'git ls-files', unless the --committable option is specified, in -# which case it runs 'git diff-index' to find out the files that can be -# committed. It return paths relative to the directory specified in the first -# argument, and using the options specified in the second argument. -__git_ls_files_helper () -{ - if [ "$2" == "--committable" ]; then - __git -C "$1" -c core.quotePath=false diff-index \ - --name-only --relative HEAD -- "${3//\\/\\\\}*" - else - # NOTE: $2 is not quoted in order to support multiple options - __git -C "$1" -c core.quotePath=false ls-files \ - --exclude-standard $2 -- "${3//\\/\\\\}*" - fi -} - - -# __git_index_files accepts 1 or 2 arguments: -# 1: Options to pass to ls-files (required). -# 2: A directory path (optional). -# If provided, only files within the specified directory are listed. -# Sub directories are never recursed. Path must have a trailing -# slash. -# 3: List only paths matching this path component (optional). -__git_index_files () -{ - local root="$2" match="$3" - - __git_ls_files_helper "$root" "$1" "$match" | - awk -F / -v pfx="${2//\\/\\\\}" '{ - paths[$1] = 1 - } - END { - for (p in paths) { - if (substr(p, 1, 1) != "\"") { - # No special characters, easy! - print pfx p - continue - } - - # The path is quoted. - p = dequote(p) - if (p == "") - continue - - # Even when a directory name itself does not contain - # any special characters, it will still be quoted if - # any of its (stripped) trailing path components do. - # Because of this we may have seen the same direcory - # both quoted and unquoted. - if (p in paths) - # We have seen the same directory unquoted, - # skip it. - continue - else - print pfx p - } - } - function dequote(p, bs_idx, out, esc, esc_idx, dec) { - # Skip opening double quote. - p = substr(p, 2) - - # Interpret backslash escape sequences. - while ((bs_idx = index(p, "\\")) != 0) { - out = out substr(p, 1, bs_idx - 1) - esc = substr(p, bs_idx + 1, 1) - p = substr(p, bs_idx + 2) - - if ((esc_idx = index("abtvfr\"\\", esc)) != 0) { - # C-style one-character escape sequence. - out = out substr("\a\b\t\v\f\r\"\\", - esc_idx, 1) - } else if (esc == "n") { - # Uh-oh, a newline character. - # We cant reliably put a pathname - # containing a newline into COMPREPLY, - # and the newline would create a mess. - # Skip this path. - return "" - } else { - # Must be a \nnn octal value, then. - dec = esc * 64 + \ - substr(p, 1, 1) * 8 + \ - substr(p, 2, 1) - out = out sprintf("%c", dec) - p = substr(p, 3) - } - } - # Drop closing double quote, if there is one. - # (There isnt any if this is a directory, as it was - # already stripped with the trailing path components.) - if (substr(p, length(p), 1) == "\"") - out = out substr(p, 1, length(p) - 1) - else - out = out p - - return out - }' -} - -# __git_complete_index_file requires 1 argument: -# 1: the options to pass to ls-file -# -# The exception is --committable, which finds the files appropriate commit. -__git_complete_index_file () -{ - local dequoted_word pfx="" cur_ - - __git_dequote "$cur" - - case "$dequoted_word" in - ?*/*) - pfx="${dequoted_word%/*}/" - cur_="${dequoted_word##*/}" - ;; - *) - cur_="$dequoted_word" - esac - - __gitcomp_file_direct "$(__git_index_files "$1" "$pfx" "$cur_")" -} - -# Lists branches from the local repository. -# 1: A prefix to be added to each listed branch (optional). -# 2: List only branches matching this word (optional; list all branches if -# unset or empty). -# 3: A suffix to be appended to each listed branch (optional). -__git_heads () -{ - local pfx="${1-}" cur_="${2-}" sfx="${3-}" - - __git for-each-ref --format="${pfx//\%/%%}%(refname:strip=2)$sfx" \ - "refs/heads/$cur_*" "refs/heads/$cur_*/**" -} - -# Lists tags from the local repository. -# Accepts the same positional parameters as __git_heads() above. -__git_tags () -{ - local pfx="${1-}" cur_="${2-}" sfx="${3-}" - - __git for-each-ref --format="${pfx//\%/%%}%(refname:strip=2)$sfx" \ - "refs/tags/$cur_*" "refs/tags/$cur_*/**" -} - -# Lists refs from the local (by default) or from a remote repository. -# It accepts 0, 1 or 2 arguments: -# 1: The remote to list refs from (optional; ignored, if set but empty). -# Can be the name of a configured remote, a path, or a URL. -# 2: In addition to local refs, list unique branches from refs/remotes/ for -# 'git checkout's tracking DWIMery (optional; ignored, if set but empty). -# 3: A prefix to be added to each listed ref (optional). -# 4: List only refs matching this word (optional; list all refs if unset or -# empty). -# 5: A suffix to be appended to each listed ref (optional; ignored, if set -# but empty). -# -# Use __git_complete_refs() instead. -__git_refs () -{ - local i hash dir track="${2-}" - local list_refs_from=path remote="${1-}" - local format refs - local pfx="${3-}" cur_="${4-$cur}" sfx="${5-}" - local match="${4-}" - local fer_pfx="${pfx//\%/%%}" # "escape" for-each-ref format specifiers - - __git_find_repo_path - dir="$__git_repo_path" - - if [ -z "$remote" ]; then - if [ -z "$dir" ]; then - return - fi - else - if __git_is_configured_remote "$remote"; then - # configured remote takes precedence over a - # local directory with the same name - list_refs_from=remote - elif [ -d "$remote/.git" ]; then - dir="$remote/.git" - elif [ -d "$remote" ]; then - dir="$remote" - else - list_refs_from=url - fi - fi - - if [ "$list_refs_from" = path ]; then - if [[ "$cur_" == ^* ]]; then - pfx="$pfx^" - fer_pfx="$fer_pfx^" - cur_=${cur_#^} - match=${match#^} - fi - case "$cur_" in - refs|refs/*) - format="refname" - refs=("$match*" "$match*/**") - track="" - ;; - *) - for i in HEAD FETCH_HEAD ORIG_HEAD MERGE_HEAD REBASE_HEAD; do - case "$i" in - $match*) - if [ -e "$dir/$i" ]; then - echo "$pfx$i$sfx" - fi - ;; - esac - done - format="refname:strip=2" - refs=("refs/tags/$match*" "refs/tags/$match*/**" - "refs/heads/$match*" "refs/heads/$match*/**" - "refs/remotes/$match*" "refs/remotes/$match*/**") - ;; - esac - __git_dir="$dir" __git for-each-ref --format="$fer_pfx%($format)$sfx" \ - "${refs[@]}" - if [ -n "$track" ]; then - # employ the heuristic used by git checkout - # Try to find a remote branch that matches the completion word - # but only output if the branch name is unique - __git for-each-ref --format="$fer_pfx%(refname:strip=3)$sfx" \ - --sort="refname:strip=3" \ - "refs/remotes/*/$match*" "refs/remotes/*/$match*/**" | \ - uniq -u - fi - return - fi - case "$cur_" in - refs|refs/*) - __git ls-remote "$remote" "$match*" | \ - while read -r hash i; do - case "$i" in - *^{}) ;; - *) echo "$pfx$i$sfx" ;; - esac - done - ;; - *) - if [ "$list_refs_from" = remote ]; then - case "HEAD" in - $match*) echo "${pfx}HEAD$sfx" ;; - esac - __git for-each-ref --format="$fer_pfx%(refname:strip=3)$sfx" \ - "refs/remotes/$remote/$match*" \ - "refs/remotes/$remote/$match*/**" - else - local query_symref - case "HEAD" in - $match*) query_symref="HEAD" ;; - esac - __git ls-remote "$remote" $query_symref \ - "refs/tags/$match*" "refs/heads/$match*" \ - "refs/remotes/$match*" | - while read -r hash i; do - case "$i" in - *^{}) ;; - refs/*) echo "$pfx${i#refs/*/}$sfx" ;; - *) echo "$pfx$i$sfx" ;; # symbolic refs - esac - done - fi - ;; - esac -} - -# Completes refs, short and long, local and remote, symbolic and pseudo. -# -# Usage: __git_complete_refs [