Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
104 changes: 103 additions & 1 deletion repli
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ repli_usage() {
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") "
Expand Down Expand Up @@ -246,6 +247,28 @@ repli_show_usage() {
fi
}

# :command.usage
repli_env_usage() {
printf "repli env - Show repli environment information\n\n"

printf "%s\n" "$(bold "Usage:")"
printf " repli env\n"
printf " repli env --help | -h\n"
echo

# :command.long_usage
if [[ -n "$long_usage" ]]; then
# :command.usage_options
printf "%s\n" "$(bold "Options:")"

# :command.usage_fixed_flags
printf " %s\n" "$(green "--help, -h")"
printf " Show this help\n"
echo

fi
}

# :command.usage
repli_info_usage() {
printf "repli info - Get information on a model\n\n"
Expand Down Expand Up @@ -944,7 +967,7 @@ replace_embed_markers() {

for file in "${files[@]}"; do
if [[ ! -f "$file" ]]; then
log error "embeded file not found: $(blue "$file")"
log error "embedded file not found: $(blue "$file")"
return 1
fi

Expand Down Expand Up @@ -1228,6 +1251,30 @@ repli_show_command() {

}

# :command.function
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"
printf "REPLI_OUTPUT_DIR: %s\n" "$(yellow "$output_dir")"
printf "REPLI_TEMPLATES_DIR: %s\n" "$(yellow "$templates_dir")"
printf "REPLI_LOG_LEVEL: %s\n" "$(yellow "$log_level")"
printf "REPLICATE_HOST: %s\n" "$(yellow "$replicate_host")"

if [[ -z "$REPLICATE_API_TOKEN" ]]; then
msg=$(red "NOT SET")
else
msg="$(printf "%s...%s" "${REPLICATE_API_TOKEN:0:3}" "${REPLICATE_API_TOKEN: -3}")"
msg="$(yellow "$msg")"
fi

printf "REPLICATE_API_TOKEN: %s\n" "$msg"

}

# :command.function
repli_info_command() {

Expand Down Expand Up @@ -1492,6 +1539,13 @@ parse_requirements() {
shift $#
;;

env)
action="env"
shift
repli_env_parse_requirements "$@"
shift $#
;;

info | i)
action="info"
shift
Expand Down Expand Up @@ -1866,6 +1920,53 @@ repli_show_parse_requirements() {

}

# :command.parse_requirements
repli_env_parse_requirements() {
local key

# :command.fixed_flags_filter
while [[ $# -gt 0 ]]; do
key="$1"
case "$key" in
--help | -h)
long_usage=yes
repli_env_usage
exit
;;

*)
break
;;

esac
done

# :command.command_filter
action="env"

# :command.parse_requirements_while
while [[ $# -gt 0 ]]; do
key="$1"
case "$key" in

-?*)
printf "invalid option: %s\n" "$key" >&2
exit 1
;;

*)
# :command.parse_requirements_case
# :command.parse_requirements_case_simple
printf "invalid argument: %s\n" "$key" >&2
exit 1

;;

esac
done

}

# :command.parse_requirements
repli_info_parse_requirements() {
local key
Expand Down Expand Up @@ -2726,6 +2827,7 @@ run() {
"get") repli_get_command ;;
"edit") repli_edit_command ;;
"show") repli_show_command ;;
"env") repli_env_command ;;
"info") repli_info_command ;;
"templates") repli_templates_command ;;
"templates new") repli_templates_new_command ;;
Expand Down
3 changes: 3 additions & 0 deletions src/bashly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@ commands:
default: $REPLI_FILE
validate: file_exists

- name: env
help: Show repli environment information

- name: info
alias: i
help: Get information on a model
Expand Down
21 changes: 21 additions & 0 deletions src/commands/env.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@





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"
printf "REPLI_OUTPUT_DIR: %s\n" "$(yellow "$output_dir")"
printf "REPLI_TEMPLATES_DIR: %s\n" "$(yellow "$templates_dir")"
printf "REPLI_LOG_LEVEL: %s\n" "$(yellow "$log_level")"
printf "REPLICATE_HOST: %s\n" "$(yellow "$replicate_host")"

if [[ -z "$REPLICATE_API_TOKEN" ]]; then
msg=$(red "NOT SET")
else
msg="$(printf "%s...%s" "${REPLICATE_API_TOKEN:0:3}" "${REPLICATE_API_TOKEN: -3}")"
msg="$(yellow "$msg")"
fi

printf "REPLICATE_API_TOKEN: %s\n" "$msg"
2 changes: 1 addition & 1 deletion src/lib/replace_embed_markers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ replace_embed_markers() {

for file in "${files[@]}"; do
if [[ ! -f "$file" ]]; then
log error "embeded file not found: $(blue "$file")"
log error "embedded file not found: $(blue "$file")"
return 1
fi

Expand Down
1 change: 1 addition & 0 deletions test/approvals/repli
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ repli - Replicate AI Workspace Tool
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
7 changes: 7 additions & 0 deletions test/approvals/repli_env
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
REPLI_FILE: tmp/repli.yaml
REPLI_FILE status: NOT FOUND
REPLI_OUTPUT_DIR: tmp
REPLI_TEMPLATES_DIR: tmp/templates
REPLI_LOG_LEVEL: debug
REPLICATE_HOST: http://localhost:3000
REPLICATE_API_TOKEN: no-...ded
9 changes: 9 additions & 0 deletions test/approvals/repli_env_help
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
repli env - Show repli environment information

Usage:
repli env
repli env --help | -h

Options:
--help, -h
Show this help
1 change: 1 addition & 0 deletions test/approvals/repli_help
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ repli - Replicate AI Workspace Tool
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
Expand Down
4 changes: 4 additions & 0 deletions test/spec/env.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
describe "env"
approve "repli env --help"
approve "repli env"