|
| 1 | +--!A cross-platform build utility based on Lua |
| 2 | +-- |
| 3 | +-- Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +-- you may not use this file except in compliance with the License. |
| 5 | +-- You may obtain a copy of the License at |
| 6 | +-- |
| 7 | +-- http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +-- |
| 9 | +-- Unless required by applicable law or agreed to in writing, software |
| 10 | +-- distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +-- See the License for the specific language governing permissions and |
| 13 | +-- limitations under the License. |
| 14 | +-- |
| 15 | +-- Copyright (C) 2015-present, TBOOX Open Source Group. |
| 16 | +-- |
| 17 | +-- @author ruki |
| 18 | +-- @file find_cl6x.lua |
| 19 | +-- |
| 20 | + |
| 21 | +-- imports |
| 22 | +import("lib.detect.find_program") |
| 23 | +import("lib.detect.find_programver") |
| 24 | + |
| 25 | +-- find cl6x |
| 26 | +-- |
| 27 | +-- @param opt the argument options, e.g. {version = true} |
| 28 | +-- |
| 29 | +-- @return program, version |
| 30 | +-- |
| 31 | +-- @code |
| 32 | +-- |
| 33 | +-- local cl6x = find_cl6x() |
| 34 | +-- local cl6x, version = find_cl6x({program = "cl6x", version = true}) |
| 35 | +-- |
| 36 | +-- @endcode |
| 37 | +-- |
| 38 | +function main(opt) |
| 39 | + opt = opt or {} |
| 40 | + opt.check = "--help" |
| 41 | + opt.command = "--help" |
| 42 | + local program = find_program(opt.program or "cl6x", opt) |
| 43 | + local version = nil |
| 44 | + if program and opt.version then |
| 45 | + version = find_programver(program, opt) |
| 46 | + end |
| 47 | + return program, version |
| 48 | +end |
0 commit comments