bit_config

Git config file parser (gix-config equivalent)

git
config
gitconfig
moon add mizchi/bit_config@0.46.4
Download zip
Author
Version
0.46.4
License
Apache-2.0
Last updated
4 days ago
Downloads
52

Dependencies

README

#
config_lines_from_content

fn config_lines_from_content(content : String) -> Array[String]

Split config content into logical lines (handling continuation lines).

#
config_novalue

fn config_novalue() -> String

Sentinel value for config keys with no value (bare keys without =).

#
config_parse_size_value

fn config_parse_size_value(value : String) -> Int64?

Parse a size value with optional k/m/g suffix.

#
config_preprocess_lines_with_line_numbers

fn config_preprocess_lines_with_line_numbers(raw_lines : Array[String]) -> Array[(String, Int)]

Join continuation lines while keeping their original starting line number.

#
encode_config_value

fn encode_config_value(value : String) -> String

Encode a value for writing to a config file, adding quoting when needed (leading/trailing space, #, ;).

#
find_config_key_line_from_content

fn find_config_key_line_from_content(content : String, key : String) -> Int?

Find the line number (1-based) of a config key in content.

#
get_all_config_values_from_content

fn get_all_config_values_from_content(content : String, key : String, value_pattern : String?, fixed_value : Bool) -> Array[String]

Extract all values for a given key from content string.

#
get_config_value_from_content

fn get_config_value_from_content(content : String, key : String, value_pattern : String?, fixed_value : Bool) -> String?

Extract a config value for a given key from content string. Returns the last matching value (git semantics: last wins).

#
is_config_novalue

fn is_config_novalue(s : String) -> Bool

#
is_valid_section_name

fn is_valid_section_name(name : String) -> Bool

#
parse_bool_keyword_value

fn parse_bool_keyword_value(value : String) -> Bool?

Parse boolean keyword values: true/false/yes/no/on/off.

#
parse_config_int_value

fn parse_config_int_value(val : String) -> (Int64?, String?)

Parse an integer config value with optional k/m/g suffix.

#
parse_config_key

fn parse_config_key(key : String) -> (String, String?, String)?

Parse a config key like "section.key" or "section.subsection.key". Returns (section, subsection?, key_name) or None. Validates that the key name starts with an alphabetic character (git compat).

#
parse_config_value

fn parse_config_value(raw : String) -> String

Parse a quoted/escaped config value string.

#
parse_section_header_line

fn parse_section_header_line(line : String) -> (String, String?, String, Bool)?

Parse a section header line like [section], [section "sub"], [section.sub] (dot notation), or [section] rest. Returns (section_name, subsection?, rest_after_bracket, is_dot_form) or None. For dot notation [section.Sub], the subsection is LOWERCASED (git compat). For quoted [section "Sub"], the subsection is preserved as-is.

#
section_matches_for_insert

fn section_matches_for_insert(header_section : String, header_subsection : String?, query_section : String, query_subsection : String?, is_dot_form : Bool) -> Bool

Compare section header against query for SECTION matching (for insert). For dot-form headers, uses case-insensitive matching for the subsection. For quoted headers, uses case-sensitive subsection matching.

Source Files

Powered by MoonBit

Site sourceReport issuePackagesBuild queueSkillsStatistics

© 2026 mooncakes.io