Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v1.1.2 #2

Merged
merged 6 commits into from
Dec 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/nuco-backend-cli.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

68 changes: 68 additions & 0 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 15 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,27 @@ nuco后端命令行工具,含commit规范化提交等

## 安装方式

1. 在release中找到最新的发行版
2. 根据不同的平台下载对应的命令行工具
3. 将命令行工具的放置位置加入系统环境变量 (or PATH)
### 类Unix平台

> `nbc.exe`为Windows版, `nbc.darwin`和`nbc.linux`分别为MacOS和Linux版, 下载之后务必重命名
- `MacOS`

```shell
# MacOS
mv nbc.darwin nbc
wget https://github.com/NucoTech/nuco-backend-cli/releases/latest/download/install.darwin.sh
bash install.darwin.sh
```

- `Linux`

# Linux
mv nbc.linux nbc
```shell
wget https://github.com/NucoTech/nuco-backend-cli/releases/latest/download/install.linux.sh
bash install.linux.sh
```

### Windows平台

- 在`release`中找到最新发布的`nbc.exe`
- 将下载的`nbc.exe`所在目录加入环境变量PATH

## 注意事项

- Windows平台下请使用cmd而不是powershell,powershell的emoji有显示问题
Expand Down
1 change: 1 addition & 0 deletions initProj/default.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ func generateGitIgnoreFile() {
filePath := ".gitignore"
fileContent := ".idea/\n"
utils.WriteFile(filePath, fileContent)
fmt.Println(".gitignore生成成功!")
}

// 注册初始化命令行
Expand Down
8 changes: 4 additions & 4 deletions install.darwin.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash

print_nbc_version() {
nbc version
print_nbc_info() {
nbc info
}

if [ -e /usr/bin/nbc ]
Expand All @@ -11,9 +11,9 @@ then
echo "本地已存在nbc命令行工具!"
echo ">>> 路径位于 /usr/bin/nbc"
echo ""
print_nbc_version
print_nbc_info
else
echo ">>> 正在使用curl下载nbc..."
wget https://github.com/NucoTech/nuco-backend-cli/releases/latest/download/nbc.darwin && sudo chmod +x nbc.linux && sudo mv nbc.darwin /usr/bin/nbc
print_nbc_version
print_nbc_info
fi
8 changes: 4 additions & 4 deletions install.linux.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash

print_nbc_version() {
nbc version
print_nbc_info() {
nbc info
}

if [ -e /usr/bin/nbc ]
Expand All @@ -11,9 +11,9 @@ then
echo "本地已存在nbc命令行工具!"
echo ">>> 路径位于 /usr/bin/nbc"
echo ""
print_nbc_version
print_nbc_info
else
echo ">>> 正在使用curl下载nbc..."
wget https://github.com/NucoTech/nuco-backend-cli/releases/latest/download/nbc.linux && sudo chmod +x nbc.linux && sudo mv nbc.linux /usr/bin/nbc
print_nbc_version
print_nbc_info
fi
Binary file added nbc.darwin
Binary file not shown.
Binary file added nbc.exe
Binary file not shown.
Binary file added nbc.linux
Binary file not shown.
2 changes: 1 addition & 1 deletion utils/contants.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ package utils

// 常量信息
const (
VERSION = "v1.1.1"
VERSION = "v1.1.2"
)
11 changes: 4 additions & 7 deletions utils/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ func RunGitCommitCommand(commit string) {
runCommand(cmd)
}

func WriteFile(path, content string) {
file, err := os.OpenFile(path, os.O_WRONLY, 0777)
func WriteFile(path, content string) {
file, err := os.OpenFile(path, os.O_WRONLY | os.O_CREATE, 0777)
if err != nil {
panic("文件打开错误")
}
Expand All @@ -38,14 +38,11 @@ func WriteFile(path, content string) {

// 写入文件
write := bufio.NewWriter(file)
_, err =write.WriteString(content)
_, err = write.WriteString(content)
if err != nil {
panic("写入缓存错误")
}
err = write.Flush()
if err != nil {
panic("写入文件错误")
}
_ = write.Flush()
}
func GetLineInput(toVar *string) (int, error) {
input, err := bufio.NewReader(os.Stdin).ReadString('\n')
Expand Down