diff --git a/README.md b/README.md index a2a0fa5..af30326 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ repli simplifies working with Replicate into three steps: 1. Generate a YAML template for any Replicate model (once per model): ```console - repli templates new google/nano-banana + repli template new google/nano-banana ``` 2. Copy the template to the working directory: ```console diff --git a/repli b/repli index 14de956..176e259 100755 --- a/repli +++ b/repli @@ -26,14 +26,14 @@ repli_usage() { echo # :command.usage_commands printf "%s\n" "$(bold "Commands:")" - printf " %s Create a new configuration file from a tmeplate\n" "$(green "new") " - printf " %s Call Replicate using a configuration file and save the result\n" "$(green "get") " - printf " %s Edit the repli file\n" "$(green "edit") " - printf " %s Show the repli file\n" "$(green "show") " - printf " %s Show repli environment information\n" "$(green "env") " - printf " %s Get information on a model\n" "$(green "info") " - printf " %s Manage templates\n" "$(green "templates")" - printf " %s Manage uploaded files\n" "$(green "files") " + printf " %s Create a new configuration file from a tmeplate\n" "$(green "new") " + printf " %s Call Replicate using a configuration file and save the result\n" "$(green "get") " + printf " %s Edit the repli file\n" "$(green "edit") " + printf " %s Show the repli file\n" "$(green "show") " + printf " %s Show repli environment information\n" "$(green "env") " + printf " %s Get information on a model\n" "$(green "info") " + printf " %s Manage templates\n" "$(green "template")" + printf " %s Manage uploaded files\n" "$(green "file") " echo # :command.long_usage @@ -331,14 +331,14 @@ repli_info_usage() { } # :command.usage -repli_templates_usage() { - printf "repli templates - Manage templates\n\n" +repli_template_usage() { + printf "repli template - Manage templates\n\n" printf "Alias: t\n" echo printf "%s\n" "$(bold "Usage:")" - printf " repli templates COMMAND\n" - printf " repli templates [COMMAND] --help | -h\n" + printf " repli template COMMAND\n" + printf " repli template [COMMAND] --help | -h\n" echo # :command.usage_commands printf "%s\n" "$(bold "Commands:")" @@ -363,14 +363,14 @@ repli_templates_usage() { } # :command.usage -repli_templates_new_usage() { - printf "repli templates new - Add a new template from a remote Replicate model example\n\n" +repli_template_new_usage() { + printf "repli template new - Add a new template from a remote Replicate model example\n\n" printf "Alias: n, add\n" echo printf "%s\n" "$(bold "Usage:")" - printf " repli templates new MODEL [OPTIONS]\n" - printf " repli templates new --help | -h\n" + printf " repli template new MODEL [OPTIONS]\n" + printf " repli template new --help | -h\n" echo # :command.long_usage @@ -405,21 +405,21 @@ repli_templates_new_usage() { # :command.usage_examples printf "%s\n" "$(bold "Examples:")" - printf " repli add google/nano-banana banana\n" + printf " repli add google/nano-banana --name banana\n" echo fi } # :command.usage -repli_templates_list_usage() { - printf "repli templates list - Show list of templates\n\n" +repli_template_list_usage() { + printf "repli template list - Show list of templates\n\n" printf "Alias: ls\n" echo printf "%s\n" "$(bold "Usage:")" - printf " repli templates list [SEARCH]\n" - printf " repli templates list --help | -h\n" + printf " repli template list [SEARCH]\n" + printf " repli template list --help | -h\n" echo # :command.long_usage @@ -444,14 +444,14 @@ repli_templates_list_usage() { } # :command.usage -repli_templates_show_usage() { - printf "repli templates show - Show template\n\n" +repli_template_show_usage() { + printf "repli template show - Show template\n\n" printf "Alias: s\n" echo printf "%s\n" "$(bold "Usage:")" - printf " repli templates show TEMPLATE\n" - printf " repli templates show --help | -h\n" + printf " repli template show [SEARCH]\n" + printf " repli template show --help | -h\n" echo # :command.long_usage @@ -468,22 +468,22 @@ repli_templates_show_usage() { printf "%s\n" "$(bold "Arguments:")" # :argument.usage - printf " %s\n" "$(green "TEMPLATE")" - printf " Template name\n" + printf " %s\n" "$(green "SEARCH")" + printf " Template search string or an exact name\n" echo fi } # :command.usage -repli_templates_edit_usage() { - printf "repli templates edit - Open template in editor\n\n" +repli_template_edit_usage() { + printf "repli template edit - Open template in editor\n\n" printf "Alias: e\n" echo printf "%s\n" "$(bold "Usage:")" - printf " repli templates edit TEMPLATE\n" - printf " repli templates edit --help | -h\n" + printf " repli template edit [SEARCH]\n" + printf " repli template edit --help | -h\n" echo # :command.long_usage @@ -500,8 +500,8 @@ repli_templates_edit_usage() { printf "%s\n" "$(bold "Arguments:")" # :argument.usage - printf " %s\n" "$(green "TEMPLATE")" - printf " Template name\n" + printf " %s\n" "$(green "SEARCH")" + printf " Template search string or an exact name\n" echo # :command.usage_environment_variables @@ -517,14 +517,14 @@ repli_templates_edit_usage() { } # :command.usage -repli_templates_delete_usage() { - printf "repli templates delete - Delete template file\n\n" +repli_template_delete_usage() { + printf "repli template delete - Delete template file\n\n" printf "Alias: d, del, rm\n" echo printf "%s\n" "$(bold "Usage:")" - printf " repli templates delete TEMPLATE\n" - printf " repli templates delete --help | -h\n" + printf " repli template delete [SEARCH]\n" + printf " repli template delete --help | -h\n" echo # :command.long_usage @@ -541,22 +541,22 @@ repli_templates_delete_usage() { printf "%s\n" "$(bold "Arguments:")" # :argument.usage - printf " %s\n" "$(green "TEMPLATE")" - printf " Template name\n" + printf " %s\n" "$(green "SEARCH")" + printf " Template search string or an exact name\n" echo fi } # :command.usage -repli_files_usage() { - printf "repli files - Manage uploaded files\n\n" +repli_file_usage() { + printf "repli file - Manage uploaded files\n\n" printf "Alias: f\n" echo printf "%s\n" "$(bold "Usage:")" - printf " repli files COMMAND\n" - printf " repli files [COMMAND] --help | -h\n" + printf " repli file COMMAND\n" + printf " repli file [COMMAND] --help | -h\n" echo # :command.usage_commands printf "%s\n" "$(bold "Commands:")" @@ -578,14 +578,14 @@ repli_files_usage() { } # :command.usage -repli_files_list_usage() { - printf "repli files list - Show list of uploaded files\n\n" +repli_file_list_usage() { + printf "repli file list - Show list of uploaded files\n\n" printf "Alias: ls\n" echo printf "%s\n" "$(bold "Usage:")" - printf " repli files list [OPTIONS]\n" - printf " repli files list --help | -h\n" + printf " repli file list [OPTIONS]\n" + printf " repli file list --help | -h\n" echo # :command.long_usage @@ -613,19 +613,19 @@ repli_files_list_usage() { } # :command.usage -repli_files_upload_usage() { +repli_file_upload_usage() { if [[ -n $long_usage ]]; then - printf "repli files upload\n\n" + printf "repli file upload\n\n" printf " Upload a file to Replicate\n Note that under normal conditions, there should be no reason for you to use\n this directly. Files will be uploaded automatically as needed.\n\n" else - printf "repli files upload - Upload a file to Replicate\n\n" + printf "repli file upload - Upload a file to Replicate\n\n" fi printf "Alias: u\n" echo printf "%s\n" "$(bold "Usage:")" - printf " repli files upload FILE\n" - printf " repli files upload --help | -h\n" + printf " repli file upload FILE\n" + printf " repli file upload --help | -h\n" echo # :command.long_usage @@ -1258,7 +1258,7 @@ repli_get_command() { repli_edit_command() { # src/commands/edit.sh - config="${args[--use]}" + local config="${args[--use]}" "${EDITOR}" "$config" } @@ -1276,7 +1276,6 @@ repli_show_command() { repli_env_command() { # src/commands/env.sh - printf "REPLI_FILE: %s\n" "$(yellow "$REPLI_FILE")" [[ -f "$REPLI_FILE" ]] && msg=$(green found) || msg=$(red "NOT FOUND") printf "REPLI_FILE status: %s\n" "$msg" @@ -1324,9 +1323,9 @@ repli_info_command() { } # :command.function -repli_templates_new_command() { +repli_template_new_command() { - # src/commands/templates/new.sh + # src/commands/template/new.sh model="${args[model]}" name="${args[--name]}" force="${args[--force]}" @@ -1352,39 +1351,42 @@ repli_templates_new_command() { } # :command.function -repli_templates_list_command() { +repli_template_list_command() { - # src/commands/templates/list.sh + # src/commands/template/list.sh search="${args[search]}" show_templates_list "$search" } # :command.function -repli_templates_show_command() { +repli_template_show_command() { - # src/commands/templates/show.sh - template="${args[template]}" + # src/commands/template/show.sh + local search="${args[search]}" + template="$(select_template "$search")" file="$templates_dir/$template.yaml" yq -P -oy "$file" } # :command.function -repli_templates_edit_command() { +repli_template_edit_command() { - # src/commands/templates/edit.sh - template="${args[template]}" + # src/commands/template/edit.sh + local search="${args[search]}" + template="$(select_template "$search")" file="$templates_dir/$template.yaml" "${EDITOR}" "$file" } # :command.function -repli_templates_delete_command() { +repli_template_delete_command() { - # src/commands/templates/delete.sh - template="${args[template]}" + # src/commands/template/delete.sh + local search="${args[search]}" + template="$(select_template "$search")" file="$templates_dir/$template.yaml" log info "deleting $file" rm "$file" @@ -1392,9 +1394,9 @@ repli_templates_delete_command() { } # :command.function -repli_files_list_command() { +repli_file_list_command() { - # src/commands/files/list.sh + # src/commands/file/list.sh plain="${args[--plain]}" json="${args[--json]}" @@ -1412,9 +1414,9 @@ repli_files_list_command() { } # :command.function -repli_files_upload_command() { +repli_file_upload_command() { - # src/commands/files/upload.sh + # src/commands/file/upload.sh file="${args[file]}" files_list="$output_dir/files.ini" @@ -1574,17 +1576,17 @@ parse_requirements() { shift $# ;; - templates | t) - action="templates" + template | t) + action="template" shift - repli_templates_parse_requirements "$@" + repli_template_parse_requirements "$@" shift $# ;; - files | f) - action="files" + file | f) + action="file" shift - repli_files_parse_requirements "$@" + repli_file_parse_requirements "$@" shift $# ;; @@ -2104,7 +2106,7 @@ repli_info_parse_requirements() { } # :command.parse_requirements -repli_templates_parse_requirements() { +repli_template_parse_requirements() { local key # :command.fixed_flags_filter @@ -2113,7 +2115,7 @@ repli_templates_parse_requirements() { case "$key" in --help | -h) long_usage=yes - repli_templates_usage + repli_template_usage exit ;; @@ -2133,41 +2135,41 @@ repli_templates_parse_requirements() { new | n | add) action="new" shift - repli_templates_new_parse_requirements "$@" + repli_template_new_parse_requirements "$@" shift $# ;; list | ls) action="list" shift - repli_templates_list_parse_requirements "$@" + repli_template_list_parse_requirements "$@" shift $# ;; show | s) action="show" shift - repli_templates_show_parse_requirements "$@" + repli_template_show_parse_requirements "$@" shift $# ;; edit | e) action="edit" shift - repli_templates_edit_parse_requirements "$@" + repli_template_edit_parse_requirements "$@" shift $# ;; delete | d | del | rm) action="delete" shift - repli_templates_delete_parse_requirements "$@" + repli_template_delete_parse_requirements "$@" shift $# ;; # :command.command_fallback "") - repli_templates_usage >&2 + repli_template_usage >&2 exit 1 ;; @@ -2202,7 +2204,7 @@ repli_templates_parse_requirements() { } # :command.parse_requirements -repli_templates_new_parse_requirements() { +repli_template_new_parse_requirements() { local key # :command.fixed_flags_filter @@ -2211,7 +2213,7 @@ repli_templates_new_parse_requirements() { case "$key" in --help | -h) long_usage=yes - repli_templates_new_usage + repli_template_new_usage exit ;; @@ -2223,7 +2225,7 @@ repli_templates_new_parse_requirements() { done # :command.command_filter - action="templates new" + action="template new" # :command.parse_requirements_while while [[ $# -gt 0 ]]; do @@ -2275,10 +2277,10 @@ repli_templates_new_parse_requirements() { # :command.required_args_filter if [[ -z ${args['model']+x} ]]; then - printf "missing required argument: MODEL\nusage: repli templates new MODEL [OPTIONS]\n" >&2 + printf "missing required argument: MODEL\nusage: repli template new MODEL [OPTIONS]\n" >&2 # :command.examples_on_error printf "examples:\n" >&2 - printf " repli add google/nano-banana banana\n" >&2 + printf " repli add google/nano-banana --name banana\n" >&2 exit 1 fi @@ -2299,7 +2301,7 @@ repli_templates_new_parse_requirements() { } # :command.parse_requirements -repli_templates_list_parse_requirements() { +repli_template_list_parse_requirements() { local key # :command.fixed_flags_filter @@ -2308,7 +2310,7 @@ repli_templates_list_parse_requirements() { case "$key" in --help | -h) long_usage=yes - repli_templates_list_usage + repli_template_list_usage exit ;; @@ -2320,7 +2322,7 @@ repli_templates_list_parse_requirements() { done # :command.command_filter - action="templates list" + action="template list" # :command.parse_requirements_while while [[ $# -gt 0 ]]; do @@ -2359,7 +2361,7 @@ repli_templates_list_parse_requirements() { } # :command.parse_requirements -repli_templates_show_parse_requirements() { +repli_template_show_parse_requirements() { local key # :command.fixed_flags_filter @@ -2368,7 +2370,7 @@ repli_templates_show_parse_requirements() { case "$key" in --help | -h) long_usage=yes - repli_templates_show_usage + repli_template_show_usage exit ;; @@ -2380,7 +2382,7 @@ repli_templates_show_parse_requirements() { done # :command.command_filter - action="templates show" + action="template show" # :command.parse_requirements_while while [[ $# -gt 0 ]]; do @@ -2396,8 +2398,8 @@ repli_templates_show_parse_requirements() { # :command.parse_requirements_case # :command.parse_requirements_case_simple # :argument.case - if [[ -z ${args['template']+x} ]]; then - args['template']=$1 + if [[ -z ${args['search']+x} ]]; then + args['search']=$1 shift else printf "invalid argument: %s\n" "$key" >&2 @@ -2409,23 +2411,6 @@ repli_templates_show_parse_requirements() { esac done - # :command.required_args_filter - if [[ -z ${args['template']+x} ]]; then - printf "missing required argument: TEMPLATE\nusage: repli templates show TEMPLATE\n" >&2 - - exit 1 - fi - - # :command.validations - # :argument.validations - if [[ -v args['template'] ]]; then - validation_output="$(validate_template_exists "${args['template']:-}")" - if [[ -n "$validation_output" ]]; then - printf "validation error in %s:\n%s\n" "TEMPLATE" "$validation_output" >&2 - exit 1 - fi - fi - # :command.user_filter filter_error=$(filter_templates_dir_exists) if [[ -n $filter_error ]]; then @@ -2436,7 +2421,7 @@ repli_templates_show_parse_requirements() { } # :command.parse_requirements -repli_templates_edit_parse_requirements() { +repli_template_edit_parse_requirements() { local key # :command.fixed_flags_filter @@ -2445,7 +2430,7 @@ repli_templates_edit_parse_requirements() { case "$key" in --help | -h) long_usage=yes - repli_templates_edit_usage + repli_template_edit_usage exit ;; @@ -2463,7 +2448,7 @@ repli_templates_edit_parse_requirements() { env_var_names+=("EDITOR") # :command.command_filter - action="templates edit" + action="template edit" # :command.parse_requirements_while while [[ $# -gt 0 ]]; do @@ -2479,8 +2464,8 @@ repli_templates_edit_parse_requirements() { # :command.parse_requirements_case # :command.parse_requirements_case_simple # :argument.case - if [[ -z ${args['template']+x} ]]; then - args['template']=$1 + if [[ -z ${args['search']+x} ]]; then + args['search']=$1 shift else printf "invalid argument: %s\n" "$key" >&2 @@ -2492,23 +2477,6 @@ repli_templates_edit_parse_requirements() { esac done - # :command.required_args_filter - if [[ -z ${args['template']+x} ]]; then - printf "missing required argument: TEMPLATE\nusage: repli templates edit TEMPLATE\n" >&2 - - exit 1 - fi - - # :command.validations - # :argument.validations - if [[ -v args['template'] ]]; then - validation_output="$(validate_template_exists "${args['template']:-}")" - if [[ -n "$validation_output" ]]; then - printf "validation error in %s:\n%s\n" "TEMPLATE" "$validation_output" >&2 - exit 1 - fi - fi - # :command.user_filter filter_error=$(filter_templates_dir_exists) if [[ -n $filter_error ]]; then @@ -2519,7 +2487,7 @@ repli_templates_edit_parse_requirements() { } # :command.parse_requirements -repli_templates_delete_parse_requirements() { +repli_template_delete_parse_requirements() { local key # :command.fixed_flags_filter @@ -2528,7 +2496,7 @@ repli_templates_delete_parse_requirements() { case "$key" in --help | -h) long_usage=yes - repli_templates_delete_usage + repli_template_delete_usage exit ;; @@ -2540,7 +2508,7 @@ repli_templates_delete_parse_requirements() { done # :command.command_filter - action="templates delete" + action="template delete" # :command.parse_requirements_while while [[ $# -gt 0 ]]; do @@ -2556,8 +2524,8 @@ repli_templates_delete_parse_requirements() { # :command.parse_requirements_case # :command.parse_requirements_case_simple # :argument.case - if [[ -z ${args['template']+x} ]]; then - args['template']=$1 + if [[ -z ${args['search']+x} ]]; then + args['search']=$1 shift else printf "invalid argument: %s\n" "$key" >&2 @@ -2569,23 +2537,6 @@ repli_templates_delete_parse_requirements() { esac done - # :command.required_args_filter - if [[ -z ${args['template']+x} ]]; then - printf "missing required argument: TEMPLATE\nusage: repli templates delete TEMPLATE\n" >&2 - - exit 1 - fi - - # :command.validations - # :argument.validations - if [[ -v args['template'] ]]; then - validation_output="$(validate_template_exists "${args['template']:-}")" - if [[ -n "$validation_output" ]]; then - printf "validation error in %s:\n%s\n" "TEMPLATE" "$validation_output" >&2 - exit 1 - fi - fi - # :command.user_filter filter_error=$(filter_templates_dir_exists) if [[ -n $filter_error ]]; then @@ -2596,7 +2547,7 @@ repli_templates_delete_parse_requirements() { } # :command.parse_requirements -repli_files_parse_requirements() { +repli_file_parse_requirements() { local key # :command.fixed_flags_filter @@ -2605,7 +2556,7 @@ repli_files_parse_requirements() { case "$key" in --help | -h) long_usage=yes - repli_files_usage + repli_file_usage exit ;; @@ -2625,20 +2576,20 @@ repli_files_parse_requirements() { list | ls) action="list" shift - repli_files_list_parse_requirements "$@" + repli_file_list_parse_requirements "$@" shift $# ;; upload | u) action="upload" shift - repli_files_upload_parse_requirements "$@" + repli_file_upload_parse_requirements "$@" shift $# ;; # :command.command_fallback "") - repli_files_usage >&2 + repli_file_usage >&2 exit 1 ;; @@ -2673,7 +2624,7 @@ repli_files_parse_requirements() { } # :command.parse_requirements -repli_files_list_parse_requirements() { +repli_file_list_parse_requirements() { local key # :command.fixed_flags_filter @@ -2682,7 +2633,7 @@ repli_files_list_parse_requirements() { case "$key" in --help | -h) long_usage=yes - repli_files_list_usage + repli_file_list_usage exit ;; @@ -2694,7 +2645,7 @@ repli_files_list_parse_requirements() { done # :command.command_filter - action="files list" + action="file list" # :command.parse_requirements_while while [[ $# -gt 0 ]]; do @@ -2735,7 +2686,7 @@ repli_files_list_parse_requirements() { } # :command.parse_requirements -repli_files_upload_parse_requirements() { +repli_file_upload_parse_requirements() { local key # :command.fixed_flags_filter @@ -2744,7 +2695,7 @@ repli_files_upload_parse_requirements() { case "$key" in --help | -h) long_usage=yes - repli_files_upload_usage + repli_file_upload_usage exit ;; @@ -2756,7 +2707,7 @@ repli_files_upload_parse_requirements() { done # :command.command_filter - action="files upload" + action="file upload" # :command.parse_requirements_while while [[ $# -gt 0 ]]; do @@ -2787,7 +2738,7 @@ repli_files_upload_parse_requirements() { # :command.required_args_filter if [[ -z ${args['file']+x} ]]; then - printf "missing required argument: FILE\nusage: repli files upload FILE\n" >&2 + printf "missing required argument: FILE\nusage: repli file upload FILE\n" >&2 exit 1 fi @@ -2850,15 +2801,15 @@ run() { "show") repli_show_command ;; "env") repli_env_command ;; "info") repli_info_command ;; - "templates") repli_templates_command ;; - "templates new") repli_templates_new_command ;; - "templates list") repli_templates_list_command ;; - "templates show") repli_templates_show_command ;; - "templates edit") repli_templates_edit_command ;; - "templates delete") repli_templates_delete_command ;; - "files") repli_files_command ;; - "files list") repli_files_list_command ;; - "files upload") repli_files_upload_command ;; + "template") repli_template_command ;; + "template new") repli_template_new_command ;; + "template list") repli_template_list_command ;; + "template show") repli_template_show_command ;; + "template edit") repli_template_edit_command ;; + "template delete") repli_template_delete_command ;; + "file") repli_file_command ;; + "file list") repli_file_list_command ;; + "file upload") repli_file_upload_command ;; esac } diff --git a/src/bashly.yml b/src/bashly.yml index e078d71..8c648ba 100644 --- a/src/bashly.yml +++ b/src/bashly.yml @@ -43,7 +43,8 @@ commands: filters: [templates_dir_exists] args: - - name: search + - &template_search + name: search help: Template search string or an exact name flags: @@ -138,7 +139,7 @@ commands: - repli info google/nano-banana - repli info google/nano-banana --example --plain --json -- name: templates +- name: template alias: t help: Manage templates commands: @@ -163,7 +164,7 @@ commands: default: auto examples: - - repli add google/nano-banana banana + - repli add google/nano-banana --name banana - name: list alias: [ls] @@ -177,18 +178,13 @@ commands: alias: s help: Show template filters: [templates_dir_exists] - args: - - &template - name: template - help: Template name - required: true - validate: template_exists + args: [*template_search] - name: edit alias: e help: Open template in editor filters: [templates_dir_exists] - args: [*template] + args: [*template_search] environment_variables: - name: editor help: Editor to use @@ -198,9 +194,9 @@ commands: alias: [d, del, rm] help: Delete template file filters: [templates_dir_exists] - args: [*template] + args: [*template_search] -- name: files +- name: file alias: f help: Manage uploaded files diff --git a/src/commands/edit.sh b/src/commands/edit.sh index 6412e9e..400c0fa 100644 --- a/src/commands/edit.sh +++ b/src/commands/edit.sh @@ -1,2 +1,2 @@ -config="${args[--use]}" +local config="${args[--use]}" "${EDITOR}" "$config" diff --git a/src/commands/env.sh b/src/commands/env.sh index 05e967f..2988db8 100644 --- a/src/commands/env.sh +++ b/src/commands/env.sh @@ -1,8 +1,3 @@ - - - - - printf "REPLI_FILE: %s\n" "$(yellow "$REPLI_FILE")" [[ -f "$REPLI_FILE" ]] && msg=$(green found) || msg=$(red "NOT FOUND") printf "REPLI_FILE status: %s\n" "$msg" diff --git a/src/commands/files/list.sh b/src/commands/file/list.sh similarity index 100% rename from src/commands/files/list.sh rename to src/commands/file/list.sh diff --git a/src/commands/files/upload.sh b/src/commands/file/upload.sh similarity index 100% rename from src/commands/files/upload.sh rename to src/commands/file/upload.sh diff --git a/src/commands/templates/delete.sh b/src/commands/template/delete.sh similarity index 51% rename from src/commands/templates/delete.sh rename to src/commands/template/delete.sh index 048f9ee..fee5d7d 100644 --- a/src/commands/templates/delete.sh +++ b/src/commands/template/delete.sh @@ -1,4 +1,5 @@ -template="${args[template]}" +local search="${args[search]}" +template="$(select_template "$search")" file="$templates_dir/$template.yaml" log info "deleting $file" rm "$file" diff --git a/src/commands/template/edit.sh b/src/commands/template/edit.sh new file mode 100644 index 0000000..da147a4 --- /dev/null +++ b/src/commands/template/edit.sh @@ -0,0 +1,4 @@ +local search="${args[search]}" +template="$(select_template "$search")" +file="$templates_dir/$template.yaml" +"${EDITOR}" "$file" diff --git a/src/commands/templates/list.sh b/src/commands/template/list.sh similarity index 100% rename from src/commands/templates/list.sh rename to src/commands/template/list.sh diff --git a/src/commands/templates/new.sh b/src/commands/template/new.sh similarity index 100% rename from src/commands/templates/new.sh rename to src/commands/template/new.sh diff --git a/src/commands/template/show.sh b/src/commands/template/show.sh new file mode 100644 index 0000000..bd687eb --- /dev/null +++ b/src/commands/template/show.sh @@ -0,0 +1,5 @@ +local search="${args[search]}" +template="$(select_template "$search")" +file="$templates_dir/$template.yaml" +yq -P -oy "$file" + diff --git a/src/commands/templates/edit.sh b/src/commands/templates/edit.sh deleted file mode 100644 index ac01b3c..0000000 --- a/src/commands/templates/edit.sh +++ /dev/null @@ -1,3 +0,0 @@ -template="${args[template]}" -file="$templates_dir/$template.yaml" -"${EDITOR}" "$file" diff --git a/src/commands/templates/show.sh b/src/commands/templates/show.sh deleted file mode 100644 index f382aab..0000000 --- a/src/commands/templates/show.sh +++ /dev/null @@ -1,4 +0,0 @@ -template="${args[template]}" -file="$templates_dir/$template.yaml" -yq -P -oy "$file" - diff --git a/test/approvals/echo_1_repli_template_delete_mod b/test/approvals/echo_1_repli_template_delete_mod new file mode 100644 index 0000000..f4a9a6f --- /dev/null +++ b/test/approvals/echo_1_repli_template_delete_mod @@ -0,0 +1,6 @@ +Templates in tmp/templates: + + 1. model1 + 2. model2 + +• info • repli_template_delete_command → deleting tmp/templates/model1.yaml diff --git a/test/approvals/echo_1_repli_template_edit_mod b/test/approvals/echo_1_repli_template_edit_mod new file mode 100644 index 0000000..0622c57 --- /dev/null +++ b/test/approvals/echo_1_repli_template_edit_mod @@ -0,0 +1,6 @@ +Templates in tmp/templates: + + 1. model1 + 2. model2 + +editstub tmp/templates/model1.yaml diff --git a/test/approvals/repli_templates_show_model1 b/test/approvals/echo_1_repli_template_show_mod similarity index 59% rename from test/approvals/repli_templates_show_model1 rename to test/approvals/echo_1_repli_template_show_mod index f0296bf..eb7dd5b 100644 --- a/test/approvals/repli_templates_show_model1 +++ b/test/approvals/echo_1_repli_template_show_mod @@ -1,3 +1,8 @@ +Templates in tmp/templates: + + 1. model1 + 2. model2 + model: google/nano-banana input: prompt: an image of a JSON file diff --git a/test/approvals/repli b/test/approvals/repli index 85cc955..917b1b0 100644 --- a/test/approvals/repli +++ b/test/approvals/repli @@ -6,11 +6,11 @@ repli - Replicate AI Workspace Tool repli --version | -v Commands: - new Create a new configuration file from a tmeplate - get Call Replicate using a configuration file and save the result - edit Edit the repli file - show Show the repli file - env Show repli environment information - info Get information on a model - templates Manage templates - files Manage uploaded files + new Create a new configuration file from a tmeplate + get Call Replicate using a configuration file and save the result + edit Edit the repli file + show Show the repli file + env Show repli environment information + info Get information on a model + template Manage templates + file Manage uploaded files diff --git a/test/approvals/repli_edit_u_custom_yaml b/test/approvals/repli_edit_u_custom_yaml deleted file mode 100644 index 00f1454..0000000 --- a/test/approvals/repli_edit_u_custom_yaml +++ /dev/null @@ -1 +0,0 @@ -editstub custom.yaml diff --git a/test/approvals/repli_files b/test/approvals/repli_file similarity index 59% rename from test/approvals/repli_files rename to test/approvals/repli_file index 0cd2001..e637261 100644 --- a/test/approvals/repli_files +++ b/test/approvals/repli_file @@ -1,10 +1,10 @@ -repli files - Manage uploaded files +repli file - Manage uploaded files Alias: f Usage: - repli files COMMAND - repli files [COMMAND] --help | -h + repli file COMMAND + repli file [COMMAND] --help | -h Commands: list Show list of uploaded files diff --git a/test/approvals/repli_files_help b/test/approvals/repli_file_help similarity index 67% rename from test/approvals/repli_files_help rename to test/approvals/repli_file_help index b69a7ed..c00aa68 100644 --- a/test/approvals/repli_files_help +++ b/test/approvals/repli_file_help @@ -1,10 +1,10 @@ -repli files - Manage uploaded files +repli file - Manage uploaded files Alias: f Usage: - repli files COMMAND - repli files [COMMAND] --help | -h + repli file COMMAND + repli file [COMMAND] --help | -h Commands: list Show list of uploaded files diff --git a/test/approvals/repli_files_list b/test/approvals/repli_file_list similarity index 100% rename from test/approvals/repli_files_list rename to test/approvals/repli_file_list diff --git a/test/approvals/repli_files_list_help b/test/approvals/repli_file_list_help similarity index 64% rename from test/approvals/repli_files_list_help rename to test/approvals/repli_file_list_help index be15cce..8a825aa 100644 --- a/test/approvals/repli_files_list_help +++ b/test/approvals/repli_file_list_help @@ -1,10 +1,10 @@ -repli files list - Show list of uploaded files +repli file list - Show list of uploaded files Alias: ls Usage: - repli files list [OPTIONS] - repli files list --help | -h + repli file list [OPTIONS] + repli file list --help | -h Options: --plain, -p diff --git a/test/approvals/repli_file_upload_fixtures_images_sample_jpg b/test/approvals/repli_file_upload_fixtures_images_sample_jpg new file mode 100644 index 0000000..0a5bb97 --- /dev/null +++ b/test/approvals/repli_file_upload_fixtures_images_sample_jpg @@ -0,0 +1,3 @@ +• info • repli_file_upload_command → uploading fixtures/images/sample.jpg +• info • repli_file_upload_command → url: https://api.replicate.com/v1/files/some-hash +• info • repli_file_upload_command → saving URL to tmp/files.ini diff --git a/test/approvals/repli_files_upload_help b/test/approvals/repli_file_upload_help similarity index 79% rename from test/approvals/repli_files_upload_help rename to test/approvals/repli_file_upload_help index 878fa45..2501d1e 100644 --- a/test/approvals/repli_files_upload_help +++ b/test/approvals/repli_file_upload_help @@ -1,4 +1,4 @@ -repli files upload +repli file upload Upload a file to Replicate Note that under normal conditions, there should be no reason for you to use @@ -7,8 +7,8 @@ repli files upload Alias: u Usage: - repli files upload FILE - repli files upload --help | -h + repli file upload FILE + repli file upload --help | -h Options: --help, -h diff --git a/test/approvals/repli_files_upload_fixtures_images_sample_jpg b/test/approvals/repli_files_upload_fixtures_images_sample_jpg deleted file mode 100644 index 59ef7a3..0000000 --- a/test/approvals/repli_files_upload_fixtures_images_sample_jpg +++ /dev/null @@ -1,3 +0,0 @@ -• info • repli_files_upload_command → uploading fixtures/images/sample.jpg -• info • repli_files_upload_command → url: https://api.replicate.com/v1/files/some-hash -• info • repli_files_upload_command → saving URL to tmp/files.ini diff --git a/test/approvals/repli_files_upload_fixtures_sample_jpg@again b/test/approvals/repli_files_upload_fixtures_sample_jpg@again index 6fc5b60..b3cec8e 100644 --- a/test/approvals/repli_files_upload_fixtures_sample_jpg@again +++ b/test/approvals/repli_files_upload_fixtures_sample_jpg@again @@ -1,3 +1,3 @@ -• debug • repli_files_upload_command → reading files list: tmp/files.ini -• info • repli_files_upload_command → upload skipped, already registered in tmp/files.ini -• info • repli_files_upload_command → url: https://api.replicate.com/v1/files/some-hash +• debug • repli_file_upload_command → reading files list: tmp/files.ini +• info • repli_file_upload_command → upload skipped, already registered in tmp/files.ini +• info • repli_file_upload_command → url: https://api.replicate.com/v1/files/some-hash diff --git a/test/approvals/repli_get_error b/test/approvals/repli_get_error deleted file mode 100644 index 8106324..0000000 --- a/test/approvals/repli_get_error +++ /dev/null @@ -1,13 +0,0 @@ -• debug • repli_get_command → config: repli.yaml -• debug • repli_get_command → prefix: repli-1 -• debug • repli_get_command → outfile: repli-1.json -• info • repli_get_command → calling API and saving repli-1.json -• error • verify_success_json → received invalid response: -detail: | - - input.image_input.0: Invalid type. Expected: string, given: object -status: 422 -title: Input validation failed -invalid_fields: - - type: invalid_type - field: input.image_input.0 - description: 'Invalid type. Expected: string, given: object' diff --git a/test/approvals/repli_get_get b/test/approvals/repli_get_get deleted file mode 100644 index 9009a97..0000000 --- a/test/approvals/repli_get_get +++ /dev/null @@ -1,6 +0,0 @@ -• debug • repli_get_command → config: tmp/repli.yaml -• debug • repli_get_command → prefix: get -• debug • repli_get_command → outfile: tmp/get.json -• info • repli_get_command → calling API and saving tmp/get.json -• debug • download_outputs → downloading from: http://localhost:3000/assets/out-0.jpg -• info • download_outputs → downloading to tmp/get_out-0.jpg diff --git a/test/approvals/repli_get_myfiles b/test/approvals/repli_get_myfiles deleted file mode 100644 index 64d037b..0000000 --- a/test/approvals/repli_get_myfiles +++ /dev/null @@ -1,6 +0,0 @@ -• debug • repli_get_command → config: tmp/repli.yaml -• debug • repli_get_command → prefix: myfiles -• debug • repli_get_command → outfile: tmp/myfiles.json -• info • repli_get_command → calling API and saving tmp/myfiles.json -• debug • download_outputs → downloading from: http://localhost:3000/assets/out-0.jpg -• info • download_outputs → downloading to tmp/myfiles_out-0.jpg diff --git a/test/approvals/repli_get_tmp_get b/test/approvals/repli_get_tmp_get deleted file mode 100644 index 45916d6..0000000 --- a/test/approvals/repli_get_tmp_get +++ /dev/null @@ -1,6 +0,0 @@ -• debug • repli_get_command → config: tmp/repli.yaml -• debug • repli_get_command → prefix: tmp/get -• debug • repli_get_command → outfile: tmp/get.json -• info • repli_get_command → calling API and saving tmp/get.json -• debug • download_outputs → downloading from: http://localhost:3000/assets/out-0.jpg -• info • download_outputs → downloading to tmp/get_out-0.jpg diff --git a/test/approvals/repli_get_tmp_get@again b/test/approvals/repli_get_tmp_get@again deleted file mode 100644 index 375116a..0000000 --- a/test/approvals/repli_get_tmp_get@again +++ /dev/null @@ -1,5 +0,0 @@ -• debug • repli_get_command → config: tmp/repli.yaml -• debug • repli_get_command → prefix: tmp/get -• debug • repli_get_command → outfile: tmp/get.json -• info • repli_get_command → skipping API call, file exists: tmp/get.json -• info • download_outputs → skipping download, file exists: tmp/get_out-0.jpg diff --git a/test/approvals/repli_get_x_get@again b/test/approvals/repli_get_x_get@again deleted file mode 100644 index bef9d3f..0000000 --- a/test/approvals/repli_get_x_get@again +++ /dev/null @@ -1,5 +0,0 @@ -• debug • repli_get_command → config: tmp/repli.yaml -• debug • repli_get_command → prefix: x -• debug • repli_get_command → outfile: tmp/x.json -• info • repli_get_command → skipping API call, file exists: tmp/x.json -• info • download_outputs → skipping download, file exists: tmp/x_out-0.jpg diff --git a/test/approvals/repli_help b/test/approvals/repli_help index f265c91..1b78e69 100644 --- a/test/approvals/repli_help +++ b/test/approvals/repli_help @@ -6,14 +6,14 @@ repli - Replicate AI Workspace Tool repli --version | -v Commands: - new Create a new configuration file from a tmeplate - get Call Replicate using a configuration file and save the result - edit Edit the repli file - show Show the repli file - env Show repli environment information - info Get information on a model - templates Manage templates - files Manage uploaded files + new Create a new configuration file from a tmeplate + get Call Replicate using a configuration file and save the result + edit Edit the repli file + show Show the repli file + env Show repli environment information + info Get information on a model + template Manage templates + file Manage uploaded files Options: --help, -h diff --git a/test/approvals/repli_templates b/test/approvals/repli_template similarity index 73% rename from test/approvals/repli_templates rename to test/approvals/repli_template index 03755a6..5ee0a37 100644 --- a/test/approvals/repli_templates +++ b/test/approvals/repli_template @@ -1,10 +1,10 @@ -repli templates - Manage templates +repli template - Manage templates Alias: t Usage: - repli templates COMMAND - repli templates [COMMAND] --help | -h + repli template COMMAND + repli template [COMMAND] --help | -h Commands: new Add a new template from a remote Replicate model example diff --git a/test/approvals/repli_template_delete b/test/approvals/repli_template_delete new file mode 100644 index 0000000..b521786 --- /dev/null +++ b/test/approvals/repli_template_delete @@ -0,0 +1 @@ +Templates dir not found (tmp/templates), set using REPLI_TEMPLATES_DIR diff --git a/test/approvals/repli_template_delete_help b/test/approvals/repli_template_delete_help new file mode 100644 index 0000000..22d28b3 --- /dev/null +++ b/test/approvals/repli_template_delete_help @@ -0,0 +1,15 @@ +repli template delete - Delete template file + +Alias: d, del, rm + +Usage: + repli template delete [SEARCH] + repli template delete --help | -h + +Options: + --help, -h + Show this help + +Arguments: + SEARCH + Template search string or an exact name diff --git a/test/approvals/repli_template_delete_missing_template b/test/approvals/repli_template_delete_missing_template new file mode 100644 index 0000000..b521786 --- /dev/null +++ b/test/approvals/repli_template_delete_missing_template @@ -0,0 +1 @@ +Templates dir not found (tmp/templates), set using REPLI_TEMPLATES_DIR diff --git a/test/approvals/repli_template_delete_model1 b/test/approvals/repli_template_delete_model1 new file mode 100644 index 0000000..bcfd170 --- /dev/null +++ b/test/approvals/repli_template_delete_model1 @@ -0,0 +1 @@ +• info • repli_template_delete_command → deleting tmp/templates/model1.yaml diff --git a/test/approvals/repli_template_edit b/test/approvals/repli_template_edit new file mode 100644 index 0000000..b521786 --- /dev/null +++ b/test/approvals/repli_template_edit @@ -0,0 +1 @@ +Templates dir not found (tmp/templates), set using REPLI_TEMPLATES_DIR diff --git a/test/approvals/repli_templates_edit_help b/test/approvals/repli_template_edit_help similarity index 52% rename from test/approvals/repli_templates_edit_help rename to test/approvals/repli_template_edit_help index c968191..1d71dbf 100644 --- a/test/approvals/repli_templates_edit_help +++ b/test/approvals/repli_template_edit_help @@ -1,18 +1,18 @@ -repli templates edit - Open template in editor +repli template edit - Open template in editor Alias: e Usage: - repli templates edit TEMPLATE - repli templates edit --help | -h + repli template edit [SEARCH] + repli template edit --help | -h Options: --help, -h Show this help Arguments: - TEMPLATE - Template name + SEARCH + Template search string or an exact name Environment Variables: EDITOR diff --git a/test/approvals/repli_template_edit_missing_template b/test/approvals/repli_template_edit_missing_template new file mode 100644 index 0000000..b521786 --- /dev/null +++ b/test/approvals/repli_template_edit_missing_template @@ -0,0 +1 @@ +Templates dir not found (tmp/templates), set using REPLI_TEMPLATES_DIR diff --git a/test/approvals/repli_templates_edit_model1 b/test/approvals/repli_template_edit_model1 similarity index 100% rename from test/approvals/repli_templates_edit_model1 rename to test/approvals/repli_template_edit_model1 diff --git a/test/approvals/repli_templates_help b/test/approvals/repli_template_help similarity index 77% rename from test/approvals/repli_templates_help rename to test/approvals/repli_template_help index 873b445..860be85 100644 --- a/test/approvals/repli_templates_help +++ b/test/approvals/repli_template_help @@ -1,10 +1,10 @@ -repli templates - Manage templates +repli template - Manage templates Alias: t Usage: - repli templates COMMAND - repli templates [COMMAND] --help | -h + repli template COMMAND + repli template [COMMAND] --help | -h Commands: new Add a new template from a remote Replicate model example diff --git a/test/approvals/repli_templates_list b/test/approvals/repli_template_list similarity index 100% rename from test/approvals/repli_templates_list rename to test/approvals/repli_template_list diff --git a/test/approvals/repli_templates_list_help b/test/approvals/repli_template_list_help similarity index 57% rename from test/approvals/repli_templates_list_help rename to test/approvals/repli_template_list_help index a4ffec1..6b7f23c 100644 --- a/test/approvals/repli_templates_list_help +++ b/test/approvals/repli_template_list_help @@ -1,10 +1,10 @@ -repli templates list - Show list of templates +repli template list - Show list of templates Alias: ls Usage: - repli templates list [SEARCH] - repli templates list --help | -h + repli template list [SEARCH] + repli template list --help | -h Options: --help, -h diff --git a/test/approvals/repli_templates_list_model b/test/approvals/repli_template_list_model similarity index 100% rename from test/approvals/repli_templates_list_model rename to test/approvals/repli_template_list_model diff --git a/test/approvals/repli_templates_list_nosuchmodel b/test/approvals/repli_template_list_nosuchmodel similarity index 100% rename from test/approvals/repli_templates_list_nosuchmodel rename to test/approvals/repli_template_list_nosuchmodel diff --git a/test/approvals/repli_template_new b/test/approvals/repli_template_new new file mode 100644 index 0000000..57f1aca --- /dev/null +++ b/test/approvals/repli_template_new @@ -0,0 +1,4 @@ +missing required argument: MODEL +usage: repli template new MODEL [OPTIONS] +examples: + repli add google/nano-banana --name banana diff --git a/test/approvals/repli_template_new_google_nano_banana b/test/approvals/repli_template_new_google_nano_banana new file mode 100644 index 0000000..d96e0f1 --- /dev/null +++ b/test/approvals/repli_template_new_google_nano_banana @@ -0,0 +1,3 @@ +• debug • repli_template_new_command → fetching example for google/nano-banana +• debug • get_model_info → calling replicate API +• info • repli_template_new_command → saving to tmp/templates/nano-banana.yaml diff --git a/test/approvals/repli_template_new_google_nano_banana_force b/test/approvals/repli_template_new_google_nano_banana_force new file mode 100644 index 0000000..d96e0f1 --- /dev/null +++ b/test/approvals/repli_template_new_google_nano_banana_force @@ -0,0 +1,3 @@ +• debug • repli_template_new_command → fetching example for google/nano-banana +• debug • get_model_info → calling replicate API +• info • repli_template_new_command → saving to tmp/templates/nano-banana.yaml diff --git a/test/approvals/repli_template_new_google_nano_banana_name_banana b/test/approvals/repli_template_new_google_nano_banana_name_banana new file mode 100644 index 0000000..42d809d --- /dev/null +++ b/test/approvals/repli_template_new_google_nano_banana_name_banana @@ -0,0 +1,3 @@ +• debug • repli_template_new_command → fetching example for google/nano-banana +• debug • get_model_info → calling replicate API +• info • repli_template_new_command → saving to tmp/templates/banana.yaml diff --git a/test/approvals/repli_templates_new_help b/test/approvals/repli_template_new_help similarity index 61% rename from test/approvals/repli_templates_new_help rename to test/approvals/repli_template_new_help index e888b9b..862676c 100644 --- a/test/approvals/repli_templates_new_help +++ b/test/approvals/repli_template_new_help @@ -1,10 +1,10 @@ -repli templates new - Add a new template from a remote Replicate model example +repli template new - Add a new template from a remote Replicate model example Alias: n, add Usage: - repli templates new MODEL [OPTIONS] - repli templates new --help | -h + repli template new MODEL [OPTIONS] + repli template new --help | -h Options: --force, -f @@ -22,4 +22,4 @@ Alias: n, add Replicate model (author/model) Examples: - repli add google/nano-banana banana + repli add google/nano-banana --name banana diff --git a/test/approvals/repli_templates_new_not_found b/test/approvals/repli_template_new_not_found similarity index 70% rename from test/approvals/repli_templates_new_not_found rename to test/approvals/repli_template_new_not_found index c02ae75..5129a21 100644 --- a/test/approvals/repli_templates_new_not_found +++ b/test/approvals/repli_template_new_not_found @@ -1,4 +1,4 @@ -• debug • repli_templates_new_command → fetching example for not/found +• debug • repli_template_new_command → fetching example for not/found • debug • get_model_info → calling replicate API • error • get_model_info → failed getting model info for not/found • error • get_model_info → (404) diff --git a/test/approvals/repli_template_show b/test/approvals/repli_template_show new file mode 100644 index 0000000..b521786 --- /dev/null +++ b/test/approvals/repli_template_show @@ -0,0 +1 @@ +Templates dir not found (tmp/templates), set using REPLI_TEMPLATES_DIR diff --git a/test/approvals/repli_template_show_help b/test/approvals/repli_template_show_help new file mode 100644 index 0000000..50eca84 --- /dev/null +++ b/test/approvals/repli_template_show_help @@ -0,0 +1,15 @@ +repli template show - Show template + +Alias: s + +Usage: + repli template show [SEARCH] + repli template show --help | -h + +Options: + --help, -h + Show this help + +Arguments: + SEARCH + Template search string or an exact name diff --git a/test/approvals/repli_template_show_missing_template b/test/approvals/repli_template_show_missing_template new file mode 100644 index 0000000..b521786 --- /dev/null +++ b/test/approvals/repli_template_show_missing_template @@ -0,0 +1 @@ +Templates dir not found (tmp/templates), set using REPLI_TEMPLATES_DIR diff --git a/test/approvals/cat_repli_yaml b/test/approvals/repli_template_show_model1 similarity index 100% rename from test/approvals/cat_repli_yaml rename to test/approvals/repli_template_show_model1 diff --git a/test/approvals/repli_templates_delete b/test/approvals/repli_templates_delete deleted file mode 100644 index cb5c097..0000000 --- a/test/approvals/repli_templates_delete +++ /dev/null @@ -1,2 +0,0 @@ -missing required argument: TEMPLATE -usage: repli templates delete TEMPLATE diff --git a/test/approvals/repli_templates_delete_help b/test/approvals/repli_templates_delete_help deleted file mode 100644 index 9631501..0000000 --- a/test/approvals/repli_templates_delete_help +++ /dev/null @@ -1,15 +0,0 @@ -repli templates delete - Delete template file - -Alias: d, del, rm - -Usage: - repli templates delete TEMPLATE - repli templates delete --help | -h - -Options: - --help, -h - Show this help - -Arguments: - TEMPLATE - Template name diff --git a/test/approvals/repli_templates_delete_missing_template b/test/approvals/repli_templates_delete_missing_template deleted file mode 100644 index dd74548..0000000 --- a/test/approvals/repli_templates_delete_missing_template +++ /dev/null @@ -1,2 +0,0 @@ -validation error in TEMPLATE: -must be an existing template diff --git a/test/approvals/repli_templates_delete_model1 b/test/approvals/repli_templates_delete_model1 deleted file mode 100644 index 48cbcbb..0000000 --- a/test/approvals/repli_templates_delete_model1 +++ /dev/null @@ -1 +0,0 @@ -• info • repli_templates_delete_command → deleting tmp/templates/model1.yaml diff --git a/test/approvals/repli_templates_edit b/test/approvals/repli_templates_edit deleted file mode 100644 index adc8861..0000000 --- a/test/approvals/repli_templates_edit +++ /dev/null @@ -1,2 +0,0 @@ -missing required argument: TEMPLATE -usage: repli templates edit TEMPLATE diff --git a/test/approvals/repli_templates_edit_missing_template b/test/approvals/repli_templates_edit_missing_template deleted file mode 100644 index dd74548..0000000 --- a/test/approvals/repli_templates_edit_missing_template +++ /dev/null @@ -1,2 +0,0 @@ -validation error in TEMPLATE: -must be an existing template diff --git a/test/approvals/repli_templates_new b/test/approvals/repli_templates_new deleted file mode 100644 index 2dbfddb..0000000 --- a/test/approvals/repli_templates_new +++ /dev/null @@ -1,4 +0,0 @@ -missing required argument: MODEL -usage: repli templates new MODEL [OPTIONS] -examples: - repli add google/nano-banana banana diff --git a/test/approvals/repli_templates_new_google_nano_banana b/test/approvals/repli_templates_new_google_nano_banana deleted file mode 100644 index 5cd4406..0000000 --- a/test/approvals/repli_templates_new_google_nano_banana +++ /dev/null @@ -1,3 +0,0 @@ -• debug • repli_templates_new_command → fetching example for google/nano-banana -• debug • get_model_info → calling replicate API -• info • repli_templates_new_command → saving to tmp/templates/nano-banana.yaml diff --git a/test/approvals/repli_templates_new_google_nano_banana@exist b/test/approvals/repli_templates_new_google_nano_banana@exist index af846b2..0248f7d 100644 --- a/test/approvals/repli_templates_new_google_nano_banana@exist +++ b/test/approvals/repli_templates_new_google_nano_banana@exist @@ -1,3 +1,3 @@ -• debug • repli_templates_new_command → target: tmp/templates/nano-banana.yaml -• error • repli_templates_new_command → target already exists: nano-banana -• info • repli_templates_new_command → use --force to overwrite or --output NAME to save with another name +• debug • repli_template_new_command → target: tmp/templates/nano-banana.yaml +• error • repli_template_new_command → target already exists: nano-banana +• info • repli_template_new_command → use --force to overwrite or --output NAME to save with another name diff --git a/test/approvals/repli_templates_new_google_nano_banana_force b/test/approvals/repli_templates_new_google_nano_banana_force deleted file mode 100644 index 5cd4406..0000000 --- a/test/approvals/repli_templates_new_google_nano_banana_force +++ /dev/null @@ -1,3 +0,0 @@ -• debug • repli_templates_new_command → fetching example for google/nano-banana -• debug • get_model_info → calling replicate API -• info • repli_templates_new_command → saving to tmp/templates/nano-banana.yaml diff --git a/test/approvals/repli_templates_new_google_nano_banana_name_banana b/test/approvals/repli_templates_new_google_nano_banana_name_banana deleted file mode 100644 index 204385f..0000000 --- a/test/approvals/repli_templates_new_google_nano_banana_name_banana +++ /dev/null @@ -1,3 +0,0 @@ -• debug • repli_templates_new_command → fetching example for google/nano-banana -• debug • get_model_info → calling replicate API -• info • repli_templates_new_command → saving to tmp/templates/banana.yaml diff --git a/test/approvals/repli_templates_show b/test/approvals/repli_templates_show deleted file mode 100644 index d166990..0000000 --- a/test/approvals/repli_templates_show +++ /dev/null @@ -1,2 +0,0 @@ -missing required argument: TEMPLATE -usage: repli templates show TEMPLATE diff --git a/test/approvals/repli_templates_show_help b/test/approvals/repli_templates_show_help deleted file mode 100644 index 375417b..0000000 --- a/test/approvals/repli_templates_show_help +++ /dev/null @@ -1,15 +0,0 @@ -repli templates show - Show template - -Alias: s - -Usage: - repli templates show TEMPLATE - repli templates show --help | -h - -Options: - --help, -h - Show this help - -Arguments: - TEMPLATE - Template name diff --git a/test/approvals/repli_templates_show_missing_template b/test/approvals/repli_templates_show_missing_template deleted file mode 100644 index dd74548..0000000 --- a/test/approvals/repli_templates_show_missing_template +++ /dev/null @@ -1,2 +0,0 @@ -validation error in TEMPLATE: -must be an existing template diff --git a/test/spec/file/list.sh b/test/spec/file/list.sh new file mode 100644 index 0000000..10c36c8 --- /dev/null +++ b/test/spec/file/list.sh @@ -0,0 +1,4 @@ +describe "files list" + approve "repli file list --help" + approve "repli file list" + diff --git a/test/spec/file/upload.sh b/test/spec/file/upload.sh new file mode 100644 index 0000000..2d6caf6 --- /dev/null +++ b/test/spec/file/upload.sh @@ -0,0 +1,7 @@ +describe "files upload" + reset_state + approve "repli file upload --help" + approve "repli file upload --help" + approve "repli file upload fixtures/images/sample.jpg" + approve "repli file upload fixtures/images/sample.jpg" "repli_files_upload_fixtures_sample_jpg@again" + rm "$output_dir/files.ini" diff --git a/test/spec/file/usage.sh b/test/spec/file/usage.sh new file mode 100644 index 0000000..7461aba --- /dev/null +++ b/test/spec/file/usage.sh @@ -0,0 +1,4 @@ +describe "files" + approve "repli file --help" + approve "repli file" + diff --git a/test/spec/files/list.sh b/test/spec/files/list.sh deleted file mode 100644 index a89b787..0000000 --- a/test/spec/files/list.sh +++ /dev/null @@ -1,4 +0,0 @@ -describe "files list" - approve "repli files list --help" - approve "repli files list" - diff --git a/test/spec/files/upload.sh b/test/spec/files/upload.sh deleted file mode 100644 index 2cf08a3..0000000 --- a/test/spec/files/upload.sh +++ /dev/null @@ -1,7 +0,0 @@ -describe "files upload" - reset_state - approve "repli files upload --help" - approve "repli files upload --help" - approve "repli files upload fixtures/images/sample.jpg" - approve "repli files upload fixtures/images/sample.jpg" "repli_files_upload_fixtures_sample_jpg@again" - rm "$output_dir/files.ini" diff --git a/test/spec/files/usage.sh b/test/spec/files/usage.sh deleted file mode 100644 index e0fbfa9..0000000 --- a/test/spec/files/usage.sh +++ /dev/null @@ -1,4 +0,0 @@ -describe "files" - approve "repli files --help" - approve "repli files" - diff --git a/test/spec/template/delete.sh b/test/spec/template/delete.sh new file mode 100644 index 0000000..7b59e5d --- /dev/null +++ b/test/spec/template/delete.sh @@ -0,0 +1,11 @@ +describe "templates delete" + reset_state + approve "repli template delete --help" + approve "repli template delete" + approve "repli template delete missing-template" + add_templates + approve "repli template delete model1" + + context "interactive template select" + add_templates + approve "echo 1 | repli template delete mod" diff --git a/test/spec/template/edit.sh b/test/spec/template/edit.sh new file mode 100644 index 0000000..286052a --- /dev/null +++ b/test/spec/template/edit.sh @@ -0,0 +1,12 @@ +describe "templates edit" + reset_state + approve "repli template edit --help" + approve "repli template edit" + approve "repli template edit missing-template" + add_templates + approve "repli template edit model1" + + context "interactive template select" + add_templates + approve "echo 1 | repli template edit mod" + diff --git a/test/spec/template/list.sh b/test/spec/template/list.sh new file mode 100644 index 0000000..336e766 --- /dev/null +++ b/test/spec/template/list.sh @@ -0,0 +1,9 @@ +describe "templates list" + reset_state + approve "repli template list --help" + approve "repli template list" "repli_templates_list@empty" + add_templates + approve "repli template list" + approve "repli template list model" + approve "repli template list nosuchmodel" + diff --git a/test/spec/template/new.sh b/test/spec/template/new.sh new file mode 100644 index 0000000..15ecc9e --- /dev/null +++ b/test/spec/template/new.sh @@ -0,0 +1,12 @@ +describe "templates new" + reset_state + approve "repli template new --help" + approve "repli template new" + approve "repli template new google/nano-banana" + approve "repli template new google/nano-banana" "repli_templates_new_google_nano_banana@exist" + approve "repli template new google/nano-banana --force" + approve "repli template new google/nano-banana --name banana" + approve "repli template new not/found" + approve "cat $REPLI_TEMPLATES_DIR/banana.yaml" "cat_banana_yaml" + approve "ls $REPLI_TEMPLATES_DIR" + diff --git a/test/spec/template/show.sh b/test/spec/template/show.sh new file mode 100644 index 0000000..b218b1f --- /dev/null +++ b/test/spec/template/show.sh @@ -0,0 +1,12 @@ +describe "templates show" + reset_state + approve "repli template show --help" + approve "repli template show" + approve "repli template show missing-template" + add_templates + approve "repli template show model1" + + context "interactive template select" + add_templates + approve "echo 1 | repli template show mod" + diff --git a/test/spec/template/usage.sh b/test/spec/template/usage.sh new file mode 100644 index 0000000..28ff085 --- /dev/null +++ b/test/spec/template/usage.sh @@ -0,0 +1,4 @@ +describe "templates" + approve "repli template --help" + approve "repli template" + diff --git a/test/spec/templates/delete.sh b/test/spec/templates/delete.sh deleted file mode 100644 index 476b9f5..0000000 --- a/test/spec/templates/delete.sh +++ /dev/null @@ -1,8 +0,0 @@ -describe "templates delete" - reset_state - approve "repli templates delete --help" - approve "repli templates delete" - approve "repli templates delete missing-template" - add_templates - approve "repli templates delete model1" - diff --git a/test/spec/templates/edit.sh b/test/spec/templates/edit.sh deleted file mode 100644 index 6719b90..0000000 --- a/test/spec/templates/edit.sh +++ /dev/null @@ -1,8 +0,0 @@ -describe "templates edit" - reset_state - approve "repli templates edit --help" - approve "repli templates edit" - approve "repli templates edit missing-template" - add_templates - approve "repli templates edit model1" - diff --git a/test/spec/templates/list.sh b/test/spec/templates/list.sh deleted file mode 100644 index fd94911..0000000 --- a/test/spec/templates/list.sh +++ /dev/null @@ -1,9 +0,0 @@ -describe "templates list" - reset_state - approve "repli templates list --help" - approve "repli templates list" "repli_templates_list@empty" - add_templates - approve "repli templates list" - approve "repli templates list model" - approve "repli templates list nosuchmodel" - diff --git a/test/spec/templates/new.sh b/test/spec/templates/new.sh deleted file mode 100644 index 56cd19d..0000000 --- a/test/spec/templates/new.sh +++ /dev/null @@ -1,12 +0,0 @@ -describe "templates new" - reset_state - approve "repli templates new --help" - approve "repli templates new" - approve "repli templates new google/nano-banana" - approve "repli templates new google/nano-banana" "repli_templates_new_google_nano_banana@exist" - approve "repli templates new google/nano-banana --force" - approve "repli templates new google/nano-banana --name banana" - approve "repli templates new not/found" - approve "cat $REPLI_TEMPLATES_DIR/banana.yaml" "cat_banana_yaml" - approve "ls $REPLI_TEMPLATES_DIR" - diff --git a/test/spec/templates/show.sh b/test/spec/templates/show.sh deleted file mode 100644 index cb15b30..0000000 --- a/test/spec/templates/show.sh +++ /dev/null @@ -1,8 +0,0 @@ -describe "templates show" - reset_state - approve "repli templates show --help" - approve "repli templates show" - approve "repli templates show missing-template" - add_templates - approve "repli templates show model1" - diff --git a/test/spec/templates/usage.sh b/test/spec/templates/usage.sh deleted file mode 100644 index 3aa0a67..0000000 --- a/test/spec/templates/usage.sh +++ /dev/null @@ -1,4 +0,0 @@ -describe "templates" - approve "repli templates --help" - approve "repli templates" -