From cf2ccf182c0a09ad2221edaf134a9ce890644a0b Mon Sep 17 00:00:00 2001 From: Giuseppe Gadola Date: Wed, 8 Feb 2023 15:37:05 +0100 Subject: refactor: going with OOP approach - creating a pet metatable/class - storing all the pets in a table with 'pet' objects --- lua/pets/commands.lua | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lua/pets/commands.lua') diff --git a/lua/pets/commands.lua b/lua/pets/commands.lua index a211d2d..80709fd 100644 --- a/lua/pets/commands.lua +++ b/lua/pets/commands.lua @@ -4,6 +4,10 @@ vim.api.nvim_create_user_command("Pets", function() pets.show() end, {}) -- use nargs = 1 to accept arguments +vim.api.nvim_create_user_command("PetsNew", function(input) + pets.create_pet("Giulio", "cat", "brown") -- TODO: use input.args as name +end, { nargs = 1 }) -- use nargs = 1 to accept arguments + vim.api.nvim_create_user_command("PetsCloseAll", function() pets.closeAll() end, {}) -- cgit v1.3-2-g11bf