Skip to content

Package Internals

Prototypes Module

Prototypes.format_syslog Method
julia
format_syslog

source

Prototypes.reformat_msg Method
julia
reformat_msg
# we view strings as simple and everything else as complex

source

Prototypes.shorten_path_str Method
julia
shorten_path_str(path::AbstractString; max_length::Int=40, strategy::Symbol=:truncate_middle)

Shorten a file path string to a specified maximum length using various strategies.

Arguments

  • path::AbstractString: The input path to be shortened

  • max_length::Int=40: Maximum desired length of the output path

  • strategy::Symbol=:truncate_middle: Strategy to use for shortening. Options:

    • :no: Return path unchanged

    • :truncate_middle: Truncate middle of path components while preserving start/end

    • :truncate_to_last: Keep only the last n components of the path

    • :truncate_from_right: Progressively remove characters from right side of components

    • :truncate_to_unique: Reduce components to unique prefixes

Returns

  • String: The shortened path

Examples

julia
# Using different strategies
julia> shorten_path_str("/very/long/path/to/file.txt", max_length=20)
"/very/…/path/to/file.txt"

julia> shorten_path_str("/usr/local/bin/program", strategy=:truncate_to_last, max_length=20)
"/bin/program"

julia> shorten_path_str("/home/user/documents/very_long_filename.txt", strategy=:truncate_middle)
"/home/user/doc…ents/very_…name.txt"

source