Skip to content

Commit

Permalink
Improve handling of program list (for snabb --help)
Browse files Browse the repository at this point in the history
Several small fixes:

- Add src/program/programs.inc to gitignore
- Fix 'FORCE' rule trick in Makefile to ensure it is updated
- Fix usage printout to program names with punctiation (e.g. example_foo)
  • Loading branch information
lukego committed May 13, 2015
1 parent b6a4f8e commit a4c983e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ obj
/src/syscall.lua
/src/syscall
/deps/*.vsn
/src/program/programs.inc
4 changes: 2 additions & 2 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -190,10 +190,10 @@ $(INCOBJ): obj/%_inc.o: %.inc Makefile program/programs.inc | $(OBJDIR)
$(Q) luajit -bg -n $(subst /,.,$*)_inc $(basename $@).luainc $@

# Create list of programs that exist
program/programs.inc:
program/programs.inc: FORCE
@ls -1d program/*/ | xargs basename -a > $@

.FORCE: program/programs.inc
FORCE:

# extra/ third party bits and pieces
obj/strict.o: extra/strict.lua | $(OBJDIR)
Expand Down
2 changes: 1 addition & 1 deletion src/core/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ end

function usage ()
print("Usage: "..ffi.string(C.argv[0]).." <program> ...")
local programs = require("program.programs_inc"):gsub("[a-z]+", " %1")
local programs = require("program.programs_inc"):gsub("%S+", " %1")
print()
print("This snabb executable has the following programs built in:")
print(programs)
Expand Down

0 comments on commit a4c983e

Please sign in to comment.