Skip to content

Commit

Permalink
comments in glint help functions
Browse files Browse the repository at this point in the history
  • Loading branch information
TanklesXL committed Jun 20, 2024
1 parent 4344fe7 commit 818aa28
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/glint.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,12 @@ pub fn path_help(
/// Help text set with this function wil be printed at the top of the help text for every command.
/// To set help text specifically for the root command please use [`glint.command_help`](#command_help) or [`glint.path_help([],...)`](#path_help)
///
/// This function allows for user-supplied newlines in long text strings. Individual newline characters are instead converted to spaces.
/// This is useful for developers to format their help text in a more readable way in the source code.
///
/// For formatted text to appear on a new line, use 2 newline characters.
/// For formatted text to appear in a new paragraph, use 3 newline characters.
///
pub fn global_help(in glint: Glint(a), of description: String) -> Glint(a) {
Glint(
..glint,
Expand Down Expand Up @@ -317,6 +323,12 @@ pub fn command(do runner: Runner(a)) -> Command(a) {

/// Attach a helptext description to a [`Command(a)`](#Command)
///
/// This function allows for user-supplied newlines in long text strings. Individual newline characters are instead converted to spaces.
/// This is useful for developers to format their help text in a more readable way in the source code.
///
/// For formatted text to appear on a new line, use 2 newline characters.
/// For formatted text to appear in a new paragraph, use 3 newline characters.
///
pub fn command_help(of desc: String, with f: fn() -> Command(a)) -> Command(a) {
Command(..f(), description: string.trim(desc))
}
Expand Down Expand Up @@ -961,6 +973,12 @@ type FlagEntry {

/// Attach a help text description to a flag.
///
/// This function allows for user-supplied newlines in long text strings. Individual newline characters are instead converted to spaces.
/// This is useful for developers to format their help text in a more readable way in the source code.
///
/// For formatted text to appear on a new line, use 2 newline characters.
/// For formatted text to appear in a new paragraph, use 3 newline characters.
///
/// ### Example:
///
/// ```gleam
Expand Down

0 comments on commit 818aa28

Please sign in to comment.