File tree Expand file tree Collapse file tree 2 files changed +507
-4
lines changed Expand file tree Collapse file tree 2 files changed +507
-4
lines changed Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+ #
3+ # Test script for -h/--help option on all functions in ollama_bash_lib.sh
4+ #
5+
6+ # Source the library
7+ # shellcheck source=../ollama_bash_lib.sh
8+ source " $( dirname " $0 " ) /../ollama_bash_lib.sh"
9+
10+ # List of all public functions in the library
11+ functions=(
12+ ollama_api_get
13+ ollama_api_post
14+ ollama_api_ping
15+ ollama_generate_json
16+ ollama_generate
17+ ollama_generate_stream_json
18+ ollama_generate_stream
19+ ollama_messages
20+ ollama_messages_add
21+ ollama_messages_clear
22+ ollama_messages_count
23+ ollama_tools_add
24+ ollama_tools
25+ ollama_tools_count
26+ ollama_tools_clear
27+ ollama_tools_is_call
28+ ollama_tools_run
29+ ollama_chat_json
30+ ollama_chat
31+ ollama_chat_stream
32+ ollama_chat_stream_json
33+ ollama_list
34+ ollama_list_json
35+ ollama_list_array
36+ ollama_model_random
37+ ollama_model_unload
38+ ollama_ps
39+ ollama_ps_json
40+ ollama_show
41+ ollama_show_json
42+ ollama_app_installed
43+ ollama_app_turbo
44+ ollama_app_vars
45+ ollama_app_version
46+ ollama_app_version_json
47+ ollama_app_version_cli
48+ ollama_thinking
49+ ollama_lib_about
50+ ollama_lib_version
51+ ollama_eval
52+ )
53+
54+ echo " --- Testing -h for all functions (first argument) ---"
55+ for func in " ${functions[@]} " ; do
56+ printf " \n--- Testing %s -h ---\n" " $func "
57+ " $func " -h
58+ done
59+
60+ echo -e " \n\n--- Testing --help for all functions (first argument) ---"
61+ for func in " ${functions[@]} " ; do
62+ printf " \n--- Testing %s --help ---\n" " $func "
63+ " $func " --help
64+ done
65+
66+ echo -e " \n\n--- Testing help flag in various positions for functions with arguments ---"
67+ printf " \n--- Testing ollama_generate \" model\" -h ---\n"
68+ ollama_generate " model" -h
69+ printf " \n--- Testing ollama_generate \" model\" \" prompt\" --help ---\n"
70+ ollama_generate " model" " prompt" --help
71+ printf " \n--- Testing ollama_eval \" task\" -h \" model\" ---\n"
72+ ollama_eval " task" -h " model"
73+
74+ echo -e " \n\n--- Testing error handling for no-argument functions ---"
75+ printf " \n--- Testing ollama_api_ping foo ---\n"
76+ ollama_api_ping foo
77+ printf " \n--- Testing ollama_list bar baz ---\n"
78+ ollama_list bar baz
79+
80+ echo -e " \n\n--- Test complete ---"
You can’t perform that action at this time.
0 commit comments