From 59de7dc72d1fa333c1d86eb618d1e9adfea24977 Mon Sep 17 00:00:00 2001 From: Smirnov Oleksandr Date: Tue, 7 Feb 2023 15:57:28 +0200 Subject: [PATCH] remove api module --- lua/gopher/api.lua | 29 ----------------------------- lua/gopher/init.lua | 30 +++++++++++++++++++++++++++--- plugin/gopher.vim | 26 +++++++++++++------------- 3 files changed, 40 insertions(+), 45 deletions(-) delete mode 100644 lua/gopher/api.lua diff --git a/lua/gopher/api.lua b/lua/gopher/api.lua deleted file mode 100644 index 6e854af..0000000 --- a/lua/gopher/api.lua +++ /dev/null @@ -1,29 +0,0 @@ -local API = {} -local tags = require "gopher.struct_tags" -local tests = require "gopher.gotests" -local cmd = require "gopher._utils.commands" - -API.install_deps = require "gopher.installer" -API.tags_add = tags.add -API.tags_rm = tags.remove -API.impl = require "gopher.impl" -API.iferr = require "gopher.iferr" -API.comment = require "gopher.comment" -API.test_add = tests.func_test -API.test_exported = tests.all_exported_tests -API.tests_all = tests.all_tests - -API.get = function(...) - cmd("get", ...) -end -API.mod = function(...) - cmd("mod", ...) -end -API.generate = function(...) - cmd("generate", ...) -end -API.work = function(...) - cmd("work", ...) -end - -return API diff --git a/lua/gopher/init.lua b/lua/gopher/init.lua index 46b649e..677fcf8 100644 --- a/lua/gopher/init.lua +++ b/lua/gopher/init.lua @@ -1,5 +1,29 @@ -local GOPHER = {} +local stags = require "gopher.struct_tags" +local tests = require "gopher.gotests" +local cmd = require "gopher._utils.commands" +local gopher = {} -GOPHER.setup = require("gopher.config").setup +gopher.setup = require("gopher.config").setup +gopher.install_deps = require "gopher.installer" +gopher.tags_add = stags.add +gopher.tags_rm = stags.remove +gopher.impl = require "gopher.impl" +gopher.iferr = require "gopher.iferr" +gopher.comment = require "gopher.comment" +gopher.test_add = tests.func_test +gopher.test_exported = tests.all_exported_tests +gopher.tests_all = tests.all_tests +gopher.get = function(...) + cmd("get", ...) +end +gopher.mod = function(...) + cmd("mod", ...) +end +gopher.generate = function(...) + cmd("generate", ...) +end +gopher.work = function(...) + cmd("work", ...) +end -return GOPHER +return gopher diff --git a/plugin/gopher.vim b/plugin/gopher.vim index e797966..bdffbbe 100644 --- a/plugin/gopher.vim +++ b/plugin/gopher.vim @@ -1,13 +1,13 @@ -command! -nargs=* GoTagAdd :lua require"gopher.api".tags_add() -command! -nargs=* GoTagRm :lua require"gopher.api".tags_rm() -command! -nargs=* GoTestAdd :lua require"gopher.api".test_add() -command! -nargs=* GoTestsAll :lua require"gopher.api".tests_all() -command! -nargs=* GoTestsExp :lua require"gopher.api".test_exported() -command! -nargs=* GoMod :lua require"gopher.api".mod() -command! -nargs=* GoGet :lua require"gopher.api".get() -command! -nargs=* GoWork :lua require"gopher.api".work() -command! -nargs=* GoImpl :lua require"gopher.api".impl() -command! -nargs=* GoGenerate :lua require"gopher.api".generate() -command! GoCmt :lua require"gopher.api".comment() -command! GoIfErr :lua require"gopher.api".iferr() -command! GoInstallDeps :lua require"gopher.api".install_deps() +command! -nargs=* GoTagAdd :lua require"gopher".tags_add() +command! -nargs=* GoTagRm :lua require"gopher".tags_rm() +command! -nargs=* GoTestAdd :lua require"gopher".test_add() +command! -nargs=* GoTestsAll :lua require"gopher".tests_all() +command! -nargs=* GoTestsExp :lua require"gopher".test_exported() +command! -nargs=* GoMod :lua require"gopher".mod() +command! -nargs=* GoGet :lua require"gopher".get() +command! -nargs=* GoWork :lua require"gopher".work() +command! -nargs=* GoImpl :lua require"gopher".impl() +command! -nargs=* GoGenerate :lua require"gopher".generate() +command! GoCmt :lua require"gopher".comment() +command! GoIfErr :lua require"gopher".iferr() +command! GoInstallDeps :lua require"gopher".install_deps()