v.util.diff #
fn available_tools #
fn available_tools() []DiffTool
Allows public checking for the available tools and prevents repeated searches when using compare functions with automatic diff tool detection.
fn color_compare_files #
deprecated: use compare_files instead
deprecated_after: 2025-12-31
fn color_compare_files(_ string, path1 string, path2 string) string
color_compare_files returns a colored diff between two files.
fn color_compare_strings #
deprecated: use compare_text instead
deprecated_after: 2025-12-31
fn color_compare_strings(_ string, _ string, expected string, found string) string
color_compare_strings returns a colored diff between two strings.
fn compare_files #
fn compare_files(path1 string, path2 string, _ CompareOptions) !string
compare_files returns a string displaying the differences between two files.
fn compare_text #
fn compare_text(text1 string, text2 string, _ CompareTextOptions) !string
compare_text returns a string displaying the differences between two strings.
fn find_working_diff_command #
fn find_working_diff_command() !string
enum DiffTool #
enum DiffTool {
auto
diff // core package on Unix-like systems.
colordiff // `diff` wrapper.
delta // viewer for git and diff output.
// fc // built-in tool on windows. // TODO: enable when its command output can be read.
}
deprecated code :
struct CompareOptions #
@[params]
struct CompareOptions {
pub:
tool DiffTool @[deprecated_after: '2025-12-31']
// Custom args used with the diff command.
args string @[deprecated_after: '2025-12-31']
// Sets the environment variable whose value can overwrite a diff command passed to a compare function.
// It also enables the use of commands that are not in the list of known diff tools.
// Set it to `none` to disable it.
env_overwrite_var ?string = 'VDIFF_CMD' @[deprecated_after: '2025-12-31']
}
struct CompareTextOptions #
@[params]
struct CompareTextOptions {
CompareOptions
pub:
base_name string = 'base' @[deprecated_after: '2025-12-31']
target_name string = 'target' @[deprecated_after: '2025-12-31']
}