Skip to content

Commit

Permalink
Merge branch 'master' inte deining/master
Browse files Browse the repository at this point in the history
  • Loading branch information
alerque committed Dec 18, 2023
2 parents 5170ca3 + 5e77d9e commit 22ee99f
Show file tree
Hide file tree
Showing 22 changed files with 230 additions and 110 deletions.
4 changes: 0 additions & 4 deletions .env

This file was deleted.

40 changes: 40 additions & 0 deletions .github/workflows/busted.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Busted

on: [ push, pull_request ]

jobs:

busted:
strategy:
fail-fast: false
matrix:
luaVersion: [ "5.4", "5.3", "5.2", "5.1", "luajit" ] # , "luajit-openresty"
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup ‘lua’
uses: leafo/gh-actions-lua@v10
with:
luaVersion: ${{ matrix.luaVersion }}

- name: Setup ‘luarocks’
uses: leafo/gh-actions-luarocks@v4

- name: Setup test dependencies
run: |
luarocks install --deps-only lua_cliargs-dev-1.rockspec
luarocks install busted
luarocks install dkjson
luarocks install inifile
${{ matrix.luaVersion != '5.4' && 'luarocks install yaml' || '' }} # https://github.com/lubyk/yaml/issues/7
- name: Replace system cliargs with self
run: |
luarocks remove --force lua_cliargs
luarocks make
- name: Run regression tests
# disable project-local path prefixes to force use of system installation
run: busted -v --lpath="" --cpath="" -Xoutput --color
34 changes: 34 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Deploy

on: [ push, workflow_dispatch ]

jobs:

affected:
uses: lunarmodules/.github/.github/workflows/list_affected_rockspecs.yml@main

build:
needs: affected
if: ${{ needs.affected.outputs.rockspecs }}
uses: lunarmodules/.github/.github/workflows/test_build_rock.yml@main
with:
rockspecs: ${{ needs.affected.outputs.rockspecs }}

upload:
needs: [ affected, build ]
# Only run upload if:
# 1. We are on the canonical repository (no uploads from forks)
# 2. The current commit is either tagged or on the default branch (the workflow will upload dev/scm rockspecs any
# time they are touched, tagged ones whenever the edited rockspec and tag match)
# 3. Some rockspecs were changed — this implies the commit changing the rockspec is the same one that gets tagged
if: >-
${{
github.repository == 'lunarmodules/lua_cliargs' &&
( github.ref_name == 'master' || startsWith(github.ref, 'refs/tags/') ) &&
needs.affected.outputs.rockspecs
}}
uses: lunarmodules/.github/.github/workflows/upload_to_luarocks.yml@main
with:
rockspecs: ${{ needs.affected.outputs.rockspecs }}
secrets:
apikey: ${{ secrets.LUAROCKS_APIKEY }}
13 changes: 13 additions & 0 deletions .github/workflows/luacheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Luacheck

on: [push, pull_request]

jobs:

luacheck:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Luacheck
uses: lunarmodules/luacheck@v1
32 changes: 0 additions & 32 deletions .travis.yml

This file was deleted.

46 changes: 0 additions & 46 deletions .travis_setup.sh

This file was deleted.

3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# lua_cliargs

[![travis-ci status](https://secure.travis-ci.org/amireh/lua_cliargs.png)](http://travis-ci.org/#!/amireh/lua_cliargs/builds)
[![Luacheck](https://img.shields.io/github/actions/workflow/status/lunarmodules/lua_cliargs/luacheck.yml?branch=master&label=Luacheck&logo=Lua)](https://github.com/lunarmodules/lua_cliargs/actions?workflow=Luacheck)
[![Busted](https://img.shields.io/github/actions/workflow/status/lunarmodules/lua_cliargs/busted.yml?branch=master&label=Busted&logo=Lua)](https://github.com/lunarmodules/lua_cliargs/actions?workflow=Busted)

cliargs is a command-line argument parser for Lua. It supports several types of arguments:

Expand Down
62 changes: 62 additions & 0 deletions lua_cliargs-dev-1.rockspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
local package_name = "lua_cliargs"
local package_version = "dev"
local rockspec_revision = "1"
local github_account_name = "lunarmodules"
local github_repo_name = package_name

rockspec_format = "3.0"
package = package_name
version = package_version .. "-" .. rockspec_revision

source = {
url = "git+https://github.com/" .. github_account_name .. "/" .. github_repo_name .. ".git"
}
if package_version == "dev" then source.branch = "master" else source.tag = "v" .. package_version end

description = {
summary = "A command-line argument parsing module for Lua",
detailed = [[
This module adds support for accepting CLI arguments easily using multiple
notations and argument types.
cliargs allows you to define required, optional, and flag arguments.
]],
homepage = "https://github.com/"..github_account_name.."/"..github_repo_name,
issues_url = "https://github.com/"..github_account_name.."/"..github_repo_name.."/issues",
license = "MIT"
}

dependencies = {
"lua >= 5.1"
}

test_dependencies = {
"busted",
"dkjson",
"inifile",
"yaml",
}

test = {
type = "busted",
}

build = {
type = "builtin",
modules = {
["cliargs"] = "src/cliargs.lua",
["cliargs.config_loader"] = "src/cliargs/config_loader.lua",
["cliargs.constants"] = "src/cliargs/constants.lua",
["cliargs.core"] = "src/cliargs/core.lua",
["cliargs.parser"] = "src/cliargs/parser.lua",
["cliargs.printer"] = "src/cliargs/printer.lua",
["cliargs.utils.disect"] = "src/cliargs/utils/disect.lua",
["cliargs.utils.disect_argument"] = "src/cliargs/utils/disect_argument.lua",
["cliargs.utils.filter"] = "src/cliargs/utils/filter.lua",
["cliargs.utils.lookup"] = "src/cliargs/utils/lookup.lua",
["cliargs.utils.shallow_copy"] = "src/cliargs/utils/shallow_copy.lua",
["cliargs.utils.split"] = "src/cliargs/utils/split.lua",
["cliargs.utils.trim"] = "src/cliargs/utils/trim.lua",
["cliargs.utils.wordwrap"] = "src/cliargs/utils/wordwrap.lua",
}
}
File renamed without changes.
48 changes: 48 additions & 0 deletions rockspecs/lua_cliargs-3.0.2-1.rockspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
local package_name = "lua_cliargs"
local package_version = "3.0.2"
local rockspec_revision = "1"
local github_account_name = "lunarmodules"
local github_repo_name = package_name

package = package_name
version = package_version .. "-" .. rockspec_revision

source = {
url = "git+https://github.com/" .. github_account_name .. "/" .. github_repo_name .. ".git"
}
if package_version == "dev" then source.branch = "master" else source.tag = "v" .. package_version end

description = {
summary = "A command-line argument parsing module for Lua",
detailed = [[
This module adds support for accepting CLI arguments easily using multiple
notations and argument types.
cliargs allows you to define required, optional, and flag arguments.
]],
license = "MIT"
}

dependencies = {
"lua >= 5.1"
}

build = {
type = "builtin",
modules = {
["cliargs"] = "src/cliargs.lua",
["cliargs.config_loader"] = "src/cliargs/config_loader.lua",
["cliargs.constants"] = "src/cliargs/constants.lua",
["cliargs.core"] = "src/cliargs/core.lua",
["cliargs.parser"] = "src/cliargs/parser.lua",
["cliargs.printer"] = "src/cliargs/printer.lua",
["cliargs.utils.disect"] = "src/cliargs/utils/disect.lua",
["cliargs.utils.disect_argument"] = "src/cliargs/utils/disect_argument.lua",
["cliargs.utils.filter"] = "src/cliargs/utils/filter.lua",
["cliargs.utils.lookup"] = "src/cliargs/utils/lookup.lua",
["cliargs.utils.shallow_copy"] = "src/cliargs/utils/shallow_copy.lua",
["cliargs.utils.split"] = "src/cliargs/utils/split.lua",
["cliargs.utils.trim"] = "src/cliargs/utils/trim.lua",
["cliargs.utils.wordwrap"] = "src/cliargs/utils/wordwrap.lua",
}
}
4 changes: 2 additions & 2 deletions spec/cliargs_spec.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require 'spec_helper'
dofile("spec/spec_helper.lua")
local cliargs = require 'cliargs'

describe('cliargs', function()
Expand Down Expand Up @@ -63,4 +63,4 @@ describe('cliargs', function()
assert.is_nil(package.loaded['cliargs'])
end)
end)
end)
end)
15 changes: 10 additions & 5 deletions spec/config_loader_spec.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require 'spec_helper'
dofile("spec/spec_helper.lua")

describe("cliargs.config_loader", function()
local cli, args, err
Expand Down Expand Up @@ -39,14 +39,19 @@ describe("cliargs.config_loader", function()
end)

describe('#from_yaml', function()
it('works', function()
args, err = cli:parse({ '--config', 'spec/fixtures/config.yml' })
end)
-- Because it isn't easy to install on Lua 5.4, some environments can't run this test
-- https://github.com/lubyk/yaml/issues/7
local hasyaml = pcall(require, "yaml")
if hasyaml then
it('works', function()
args, err = cli:parse({ '--config', 'spec/fixtures/config.yml' })
end)
end
end)

describe('#from_lua', function()
it('works', function()
args, err = cli:parse({ '--config', 'spec/fixtures/config.lua' })
end)
end)
end)
end)
6 changes: 3 additions & 3 deletions spec/core_spec.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
local helpers = require "spec_helper"
local helpers = dofile("spec/spec_helper.lua")

describe("cliargs::core", function()
local cli
Expand Down Expand Up @@ -178,7 +178,6 @@ describe("cliargs::core", function()
end)
end)


describe('#read_defaults_from_ini_file', function()
local args, err

Expand Down Expand Up @@ -288,4 +287,5 @@ describe("cliargs::core", function()
})
end)
end)
end)

end)
4 changes: 2 additions & 2 deletions spec/features/argument_spec.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
local helpers = require("spec_helper")
local helpers = dofile("spec/spec_helper.lua")

describe("cliargs - arguments", function()
local cli
Expand Down Expand Up @@ -117,4 +117,4 @@ describe("cliargs - arguments", function()
end)
end)
end)
end)
end)
4 changes: 2 additions & 2 deletions spec/features/flag_spec.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
local helpers = require("spec_helper")
local helpers = dofile("spec/spec_helper.lua")

describe("cliargs - flags", function()
local cli
Expand Down Expand Up @@ -196,4 +196,4 @@ describe("cliargs - flags", function()
end)
end)
end)
end)
end)
Loading

0 comments on commit 22ee99f

Please sign in to comment.