From b0189e84dab3ec187b87d595fd0a1d0b221386ee Mon Sep 17 00:00:00 2001 From: V1K1NGbg Date: Sat, 17 Aug 2024 12:06:17 +0300 Subject: [PATCH 1/2] Updated argparse type definitions for the next branch of teal --- types/argparse/argparse.d.tl | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/types/argparse/argparse.d.tl b/types/argparse/argparse.d.tl index 1d12517..42e3578 100644 --- a/types/argparse/argparse.d.tl +++ b/types/argparse/argparse.d.tl @@ -20,8 +20,8 @@ local record argparse get_usage: function(self: Parser): string get_help: function(self: Parser): string - option: function(self: Parser, name: string, description: string, default: string, convert: function | {function}, args: {string}, count: integer | string): Option - option: function(self: Parser, name: string, description: string, default: string, convert: {string:string}, args: {string}, count: integer | string): Option + option: function(self: Parser, name: string, description?: string, default?: string, convert?: function | {function}, args?: {string}, count?: integer | string): Option + option: function(self: Parser, name: string, description?: string, default?: string, convert?: {string:string}, args?: {string}, count?: integer | string): Option require_command: function(self: Parser, require_command: boolean): Parser command_target: function(self: Parser, command_target: string): Parser @@ -30,6 +30,10 @@ local record argparse add_help: function(self: Parser, boolean) + help_max_width: function(self: Parser, number): Parser + add_help_command: function(self: Parser, ?string | {string: any}): Parser + add_complete_command: function(self: Parser, ?string | {string: any}): Parser + -- TODO: should be Argument | Option mutex: function(self: Parser, ...: any) @@ -74,17 +78,25 @@ local record argparse args: function(self: Option, args: string|integer): Option action: function(self: Option, cb: ActionCallback) + + hidden_name: function(self: Option, string) + + hidden: function(self: Option, boolean) + + convert: function(self: Option, function) end record Command summary: function(self: Command, summary: string): Command description: function(self: Command, description: string): Command - argument: function(self: Command, name: string, description: string): Argument + argument: function(self: Command, name: string, description?: string): Argument option: function(self: Command, name: string, description: string): Option flag: function(self: Command, string, string): Option + + handle_options: function(self: Command, boolean): Command end metamethod __call: function(self: argparse, name: string, description: string, epilog: string): Parser From 44120f0311581b133161c52e185171f87918d184 Mon Sep 17 00:00:00 2001 From: Victor Ilchev <46074073+V1K1NGbg@users.noreply.github.com> Date: Fri, 23 Aug 2024 11:38:16 +0000 Subject: [PATCH 2/2] removed the question marks --- types/argparse/argparse.d.tl | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/types/argparse/argparse.d.tl b/types/argparse/argparse.d.tl index 42e3578..b13f8ac 100644 --- a/types/argparse/argparse.d.tl +++ b/types/argparse/argparse.d.tl @@ -20,8 +20,8 @@ local record argparse get_usage: function(self: Parser): string get_help: function(self: Parser): string - option: function(self: Parser, name: string, description?: string, default?: string, convert?: function | {function}, args?: {string}, count?: integer | string): Option - option: function(self: Parser, name: string, description?: string, default?: string, convert?: {string:string}, args?: {string}, count?: integer | string): Option + option: function(self: Parser, name: string, description: string, default: string, convert: function | {function}, args: {string}, count: integer | string): Option + option: function(self: Parser, name: string, description: string, default: string, convert: {string:string}, args: {string}, count: integer | string): Option require_command: function(self: Parser, require_command: boolean): Parser command_target: function(self: Parser, command_target: string): Parser @@ -31,8 +31,8 @@ local record argparse add_help: function(self: Parser, boolean) help_max_width: function(self: Parser, number): Parser - add_help_command: function(self: Parser, ?string | {string: any}): Parser - add_complete_command: function(self: Parser, ?string | {string: any}): Parser + add_help_command: function(self: Parser, string | {string: any}): Parser + add_complete_command: function(self: Parser, string | {string: any}): Parser -- TODO: should be Argument | Option mutex: function(self: Parser, ...: any) @@ -90,7 +90,7 @@ local record argparse summary: function(self: Command, summary: string): Command description: function(self: Command, description: string): Command - argument: function(self: Command, name: string, description?: string): Argument + argument: function(self: Command, name: string, description: string): Argument option: function(self: Command, name: string, description: string): Option