Skip to content
This repository was archived by the owner on Feb 11, 2021. It is now read-only.

Commit fdb862d

Browse files
committed
initial put
1 parent b658b89 commit fdb862d

File tree

8 files changed

+103
-0
lines changed

8 files changed

+103
-0
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,5 @@ _testmain.go
2222
*.exe
2323
*.test
2424
*.prof
25+
26+
node_modules/

cli-template.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
build:
2+
- go build -o mycli src/main/*
3+
files:
4+
- .gitignore
5+
- src/main/app.go
6+
- src/main/main.go
7+
command: ./mycli

codecheck.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
build:
2+
- go build -o mycli main
3+
env:
4+
APP_COMMAND: ./mycli
5+
test: mocha

package.json

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"name": "codecheck-cli-template",
3+
"version": "1.0.0",
4+
"description": "",
5+
"scripts": {
6+
"test": "codecheck"
7+
},
8+
"repository": {
9+
"type": "git",
10+
"url": "git+https://github.com/code-check/cli-template-go.git"
11+
},
12+
"keywords": [
13+
"codecheck",
14+
"cli",
15+
"go"
16+
],
17+
"author": "Givery Inc.",
18+
"license": "ISC",
19+
"bugs": {
20+
"url": "https://github.com/code-check/cli-template-go/issues"
21+
},
22+
"homepage": "https://github.com/code-check/cli-template-go#README.md",
23+
"devDependencies": {
24+
"chai": "^3.5.0",
25+
"codecheck": "^0.5.3"
26+
}
27+
}

src/github.com/codegangsta/cli

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Subproject commit 71f57d300dd6a780ac1856c005c4b518cfd498ec

src/main/app.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package main
2+
3+
import (
4+
"fmt"
5+
"github.com/codegangsta/cli"
6+
)
7+
8+
func doMain(c * cli.Context) {
9+
for i := 0; i<len(c.Args()); i++ {
10+
fmt.Println(c.Args()[i])
11+
}
12+
}

src/main/main.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package main
2+
3+
import (
4+
"os"
5+
"github.com/codegangsta/cli"
6+
)
7+
8+
func main() {
9+
app := cli.NewApp()
10+
app.Action = doMain
11+
app.Run(os.Args)
12+
}

test/test1.js

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
"use strict";
2+
3+
var assert = require("chai").assert;
4+
var codecheck = require("codecheck");
5+
6+
describe("Echo", function() {
7+
var app = codecheck.consoleApp(process.env.APP_COMMAND);
8+
9+
it("hoge -> hoge", function() {
10+
return app.run("hoge").spread(function(code, stdOut) {
11+
console.log("test result", code, stdOut);
12+
assert.equal(code, 0);
13+
assert.equal(stdOut.length, 1);
14+
assert.equal(stdOut[0], "hoge");
15+
});
16+
});
17+
18+
it("hoge, fuga -> hoge, fuga", function() {
19+
var app = codecheck.consoleApp(process.env.APP_COMMAND);
20+
return app.run("hoge", "fuga").spread(function(code, stdOut) {
21+
assert.equal(code, 0);
22+
assert.equal(stdOut.length, 2);
23+
assert.equal(stdOut[0], "hoge");
24+
assert.equal(stdOut[1], "fuga");
25+
});
26+
});
27+
28+
it("hoge fuga -> hoge fuga", function() {
29+
var app = codecheck.consoleApp(process.env.APP_COMMAND);
30+
return app.run("hoge fuga").spread(function(code, stdOut) {
31+
assert.equal(code, 0);
32+
assert.equal(stdOut.length, 1);
33+
assert.equal(stdOut[0], "hoge fuga");
34+
});
35+
});
36+
37+
});

0 commit comments

Comments
 (0)