FZF_(HEAD|TAIL) refactor to FZF_USER_INPUT
This commit is contained in:
parent
432593a0f3
commit
b6b4f2e5b8
@ -12,7 +12,7 @@ SCWRYPTS__SELECT_ENV() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SCWRYPTS__SELECT_OR_CREATE_ENV() {
|
SCWRYPTS__SELECT_OR_CREATE_ENV() {
|
||||||
SCWRYPTS__GET_ENV_NAMES | FZF_TAIL 'select / create an environment'
|
SCWRYPTS__GET_ENV_NAMES | FZF_USER_INPUT 'select / create an environment'
|
||||||
}
|
}
|
||||||
|
|
||||||
SCWRYPTS__GET_ENV_FILES() {
|
SCWRYPTS__GET_ENV_FILES() {
|
||||||
|
@ -5,7 +5,7 @@ use media/youtube
|
|||||||
MAIN() {
|
MAIN() {
|
||||||
local URLS=($@)
|
local URLS=($@)
|
||||||
|
|
||||||
[[ ${#URLS[@]} -eq 0 ]] && URLS=($(echo '' | FZF_HEAD 'enter URL'))
|
[[ ${#URLS[@]} -eq 0 ]] && URLS=($(echo '' | FZF_USER_INPUT 'enter URL'))
|
||||||
[[ ${#URLS[@]} -eq 0 ]] && ABORT
|
[[ ${#URLS[@]} -eq 0 ]] && ABORT
|
||||||
|
|
||||||
local FILENAME=$(YT__GET_FILENAME $URLS)
|
local FILENAME=$(YT__GET_FILENAME $URLS)
|
||||||
|
@ -5,7 +5,7 @@ use media/youtube
|
|||||||
MAIN() {
|
MAIN() {
|
||||||
local URLS=($@)
|
local URLS=($@)
|
||||||
|
|
||||||
[[ ${#URLS[@]} -eq 0 ]] && URLS=($(echo '' | FZF_HEAD 'enter URL'))
|
[[ ${#URLS[@]} -eq 0 ]] && URLS=($(echo '' | FZF_USER_INPUT 'enter URL'))
|
||||||
[[ ${#URLS[@]} -eq 0 ]] && ABORT
|
[[ ${#URLS[@]} -eq 0 ]] && ABORT
|
||||||
|
|
||||||
local FILENAME=$(YT__GET_FILENAME $URLS)
|
local FILENAME=$(YT__GET_FILENAME $URLS)
|
||||||
@ -21,9 +21,9 @@ MAIN() {
|
|||||||
|
|
||||||
LENGTH=$(GET_VIDEO_LENGTH "$INPUT_FILE")
|
LENGTH=$(GET_VIDEO_LENGTH "$INPUT_FILE")
|
||||||
[ ! $LENGTH ] && { ERROR "unable to determine video length for '$INPUT_FILE'"; return 2; }
|
[ ! $LENGTH ] && { ERROR "unable to determine video length for '$INPUT_FILE'"; return 2; }
|
||||||
START_TIME=$(echo 0 | FZF_HEAD "enter start time (0 ≤ t < $LENGTH)")
|
START_TIME=$(echo 0 | FZF_USER_INPUT "enter start time (0 ≤ t < $LENGTH)")
|
||||||
[ ! $START_TIME ] && ABORT
|
[ ! $START_TIME ] && ABORT
|
||||||
END_TIME=$(echo $LENGTH | FZF_HEAD "enter end time ($START_TIME > t ≥ $LENGTH)")
|
END_TIME=$(echo $LENGTH | FZF_USER_INPUT "enter end time ($START_TIME > t ≥ $LENGTH)")
|
||||||
[ ! $END_TIME ] && ABORT
|
[ ! $END_TIME ] && ABORT
|
||||||
|
|
||||||
STATUS
|
STATUS
|
||||||
@ -32,7 +32,7 @@ MAIN() {
|
|||||||
STATUS "end time : $END_TIME"
|
STATUS "end time : $END_TIME"
|
||||||
STATUS
|
STATUS
|
||||||
OUTPUT_FILE=$(echo '' \
|
OUTPUT_FILE=$(echo '' \
|
||||||
| FZF_HEAD 'what should I call this clip? (.mp3)' \
|
| FZF_USER_INPUT 'what should I call this clip? (.mp3)' \
|
||||||
| sed 's/\.mp3$//' \
|
| sed 's/\.mp3$//' \
|
||||||
)
|
)
|
||||||
[ ! $OUTPUT_FILE ] && ABORT
|
[ ! $OUTPUT_FILE ] && ABORT
|
||||||
|
@ -3,7 +3,7 @@ use office/memo
|
|||||||
#####################################################################
|
#####################################################################
|
||||||
|
|
||||||
MAIN() {
|
MAIN() {
|
||||||
local MEMO_NAME=$(MEMO__LIST_ALL | FZF_TAIL 'select/create a memo')
|
local MEMO_NAME=$(MEMO__LIST_ALL | FZF_USER_INPUT 'select/create a memo')
|
||||||
[ ! "$MEMO_NAME" ] && ABORT
|
[ ! "$MEMO_NAME" ] && ABORT
|
||||||
|
|
||||||
MEMO_FILE="$MEMO__DIR/$MEMO_NAME.$MEMO__FILETYPE"
|
MEMO_FILE="$MEMO__DIR/$MEMO_NAME.$MEMO__FILETYPE"
|
||||||
|
@ -10,7 +10,7 @@ MAIN() {
|
|||||||
STATUS "selected '$TEMPLATE_ENV_NAME'"
|
STATUS "selected '$TEMPLATE_ENV_NAME'"
|
||||||
|
|
||||||
PROMPT 'enter new environment name'
|
PROMPT 'enter new environment name'
|
||||||
ENV_NAME=$(echo '' | FZF_HEAD 'new environment')
|
ENV_NAME=$(echo '' | FZF_USER_INPUT 'new environment')
|
||||||
[ ! $ENV_NAME ] && ABORT
|
[ ! $ENV_NAME ] && ABORT
|
||||||
SCWRYPTS__GET_ENV_NAMES | grep -q $ENV_NAME && FAIL 1 "'$ENV_NAME' already exists"
|
SCWRYPTS__GET_ENV_NAMES | grep -q $ENV_NAME && FAIL 1 "'$ENV_NAME' already exists"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user