From e05f103c415221af11889a5d5747254efd9b98d9 Mon Sep 17 00:00:00 2001 From: Enzo Baldisserri Date: Thu, 16 Apr 2020 14:50:04 +0200 Subject: [PATCH] cli: make compile --- cmd/tools/vtest-fixed.v | 2 -- vlib/cli/command.v | 8 +++++--- vlib/cli/flag_test.v | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/cmd/tools/vtest-fixed.v b/cmd/tools/vtest-fixed.v index 36c983732c..52b2bf2724 100644 --- a/cmd/tools/vtest-fixed.v +++ b/cmd/tools/vtest-fixed.v @@ -7,8 +7,6 @@ import v.pref const ( skip_test_files = [ 'vlib/arrays/arrays_test.v', - 'vlib/cli/command_test.v', - 'vlib/cli/flag_test.v', 'vlib/crypto/aes/aes_test.v', 'vlib/crypto/rand/rand_test.v', // macOS only 'vlib/crypto/rc4/rc4_test.v', diff --git a/vlib/cli/command.v b/vlib/cli/command.v index 880ae86da5..55099a7382 100644 --- a/vlib/cli/command.v +++ b/vlib/cli/command.v @@ -1,13 +1,15 @@ module cli +type CallbackFn fn(cmd Command) + pub struct Command { pub mut: name string description string version string - pre_execute fn(cmd Command) - execute fn(cmd Command) - post_execute fn(cmd Command) + pre_execute CallbackFn + execute CallbackFn + post_execute CallbackFn disable_help bool disable_version bool diff --git a/vlib/cli/flag_test.v b/vlib/cli/flag_test.v index c5278a3029..220d3f4a80 100644 --- a/vlib/cli/flag_test.v +++ b/vlib/cli/flag_test.v @@ -49,8 +49,8 @@ fn test_if_float_flag_parses() { } flag.parse(['--flag', '3.14159']) or { panic(err) } - assert flag.value.f32() == 3.14159 + assert flag.value.f64() == 3.14159 flag.parse(['--flag=3.14159']) or { panic(err) } - assert flag.value.f32() == 3.14159 + assert flag.value.f64() == 3.14159 }