Files
yaze/src/cli/handlers/agent/test_common.h
scawful 758b0c0a35 fix: Refactor test command handling with modular structure and common utilities
- Added new `test_common` module with helper functions for prompting and input handling.
- Introduced `test_common.cc` and `test_common.h` for shared functionality across test commands.
- Updated `z3ed.cmake` to include `test_common` in the build process.
- Refactored `test_commands.cc` to utilize new common utilities for improved readability and maintainability.
- Adjusted paths for source files in the build configuration to ensure proper linking.

This commit lays the groundwork for a more organized and modular approach to handling test commands, facilitating future enhancements and maintenance.
2025-10-03 02:10:18 -04:00

41 lines
1.1 KiB
C++

#ifndef YAZE_CLI_HANDLERS_AGENT_TEST_COMMON_H_
#define YAZE_CLI_HANDLERS_AGENT_TEST_COMMON_H_
#include <string>
#include <vector>
#include "absl/strings/string_view.h"
namespace yaze {
namespace cli {
namespace agent {
// Common helper functions for test command handlers
std::string TrimWhitespace(absl::string_view value);
bool IsInteractiveInput();
std::string PromptWithDefault(const std::string& prompt,
const std::string& default_value,
bool allow_empty = true);
std::string PromptRequired(const std::string& prompt,
const std::string& default_value = std::string());
int PromptInt(const std::string& prompt, int default_value, int min_value);
bool PromptYesNo(const std::string& prompt, bool default_value);
std::vector<std::string> ParseCommaSeparated(absl::string_view input);
bool ParseKeyValueEntry(const std::string& input, std::string* key,
std::string* value);
} // namespace agent
} // namespace cli
} // namespace yaze
#endif // YAZE_CLI_HANDLERS_AGENT_TEST_COMMON_H_