instow

:)
git clone https://git.sr.ht/~ashymad/instow
Log | Files | Refs | LICENSE

tools.janet (818B)


      1 (import ./file)
      2 
      3 (defn toolpath [tool]
      4   (case tool
      5     :make ["make" "gmake"]
      6     :ninja ["ninja"]
      7     :cmake ["cmake"]
      8     :qmake ["qmake" "qmake6"]
      9     :configure ["./configure"]
     10     :autogen ["./autogen.sh"]
     11     :autoreconf ["autoreconf"]
     12     :ldconfig ["ldconfig" "/sbin/ldconfig"]
     13     :jpm ["jpm"]
     14     :go ["go"]
     15     :python ["python" "python3"]
     16     :pip ["pip" "pip3"]
     17     :cargo ["cargo"]
     18     :meson ["meson"]
     19     :waf ["./waf" "waf"]
     20     :rinstall ["rinstall"]
     21     :npm ["npm"]
     22     :stow ["stow" "xstow"]))
     23 
     24 (defn gettool [tool]
     25   (var ret nil)
     26   (each path (array/concat @[(os/getenv (string/ascii-upper tool))] (toolpath tool))
     27     (if (not (nil? path))
     28       (let [fullpath (file/which path)]
     29         (if (not (nil? fullpath)) 
     30           (do
     31             (set ret fullpath)
     32             (break))))))
     33   ret)
     34