From 5b0fc97f8ae29ddd2668eced7f352337d5d07f52 Mon Sep 17 00:00:00 2001 From: Eamon Burns Date: Sun, 8 Sep 2024 16:33:30 -0700 Subject: [PATCH] fix(parsers): check if `vim.fn.has()` is 1 (#54) * feat(parsers): move all parsers to their own submodule (#43) BREAKING CHANGE: Parser modules have been moved Add `check` functions to all parser modules * fix: Termux compatible `is_readable_directory` function (#42) * feat(util): use test command to check directory * fix: use single quotes in util/file.lua * feat(util): add type hints and documentation, remove old function * feat(parsers): move all parsers to their own submodule (#43) BREAKING CHANGE: Parser modules have been moved Add `check` functions to all parser modules * feat(util): use old "readable directory" method when not in Termux * docs: start adding type definitions * docs: consistent doc-comment * fix: error on windows with no battery (#51) * feat(parsers): move all parsers to their own submodule (#43) BREAKING CHANGE: Parser modules have been moved Add `check` functions to all parser modules * fix: Termux compatible `is_readable_directory` function (#42) * feat(util): use test command to check directory * fix: use single quotes in util/file.lua * feat(util): add type hints and documentation, remove old function * feat(parsers): move all parsers to their own submodule (#43) BREAKING CHANGE: Parser modules have been moved Add `check` functions to all parser modules * feat(util): use old "readable directory" method when not in Termux * docs: start adding type definitions * docs: consistent doc-comment * fix(parsers/powershell): default to 2 when no batteries * fix(parsers): check if `vim.fn.has()` is `1` --- lua/battery/parsers/powershell.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lua/battery/parsers/powershell.lua b/lua/battery/parsers/powershell.lua index 40e687a..46a3235 100644 --- a/lua/battery/parsers/powershell.lua +++ b/lua/battery/parsers/powershell.lua @@ -97,7 +97,10 @@ end ---Check if this parser would work in the current environment ---@return boolean function M.check() - return vim.fn.has('win32') and vim.fn.executable('powershell') == 1 + return ( + vim.fn.has('win32') == 1 + and vim.fn.executable('powershell') == 1 + ) end return M