Skip to content

Commit

Permalink
Fix unexcept error for the config (#16)
Browse files Browse the repository at this point in the history
* fix: not except error echo for the config not exist

* docs: update the md styles
  • Loading branch information
saltbo committed Jun 27, 2020
1 parent 590424b commit fc2c45d
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 14 deletions.
3 changes: 1 addition & 2 deletions CODE_OF_CONDUCT.md → CODEOFCONDUCT.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

# Contributor Covenant Code of Conduct

## Our Pledge
Expand Down Expand Up @@ -61,7 +60,7 @@ representative at an online or offline event.

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at
[INSERT CONTACT METHOD].
[saltbo@foxmail.com].
All complaints will be reviewed and investigated promptly and fairly.

All community leaders are obligated to respect the privacy and security of the
Expand Down
3 changes: 1 addition & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Contributing

By participating to this project, you agree to abide our [code of conduct](/CODE_OF_CONDUCT.md).
By participating to this project, you agree to abide our [code of conduct](/CODEOFCONDUCT.md).

## Setup your machine

Expand Down Expand Up @@ -71,4 +71,3 @@ Thank you to all our backers! [[Become a backer](https://opencollective.com/salt
### Sponsors

Thank you to all our sponsors! (please ask your company to also support this open source project by [becoming a sponsor](https://opencollective.com/saltbo#sponsor))

14 changes: 6 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ English | [🇨🇳中文](https://saltbo.cn/uptoc)

**homebrew tap**:

```console
$ brew install saltbo/bin/uptoc
```bash
brew install saltbo/bin/uptoc
```

**homebrew** (may not be the latest version):

```console
$ brew install uptoc
```bash
brew install uptoc
```

**deb/rpm**:
Expand All @@ -41,17 +41,15 @@ install with `dpkg -i` and `rpm -i` respectively.

**Shell script**:

```console
$ curl -sSf https://static.saltbo.cn/github.com/uptoc/install.sh | sh
```bash
curl -sSf https://static.saltbo.cn/github.com/uptoc/install.sh | sh
```

**manually**:

Download the pre-compiled binaries from the [releases page](https://github.com/saltbo/uptoc/releases) and
copy to the desired location.



## Usage

### Basic
Expand Down
4 changes: 2 additions & 2 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func ParseFromRC() (*Config, error) {
}

rcPath := filepath.Join(homeDir, ".uptocrc")
f, err := os.OpenFile(rcPath, os.O_CREATE|os.O_RDWR, 0644)
f, err := os.OpenFile(rcPath, os.O_RDWR, 0644)
if os.IsNotExist(err) {
return nil, fmt.Errorf("please setup your config by run `uptoc config`")
} else if err != nil {
Expand All @@ -69,7 +69,7 @@ func ParseFromRC() (*Config, error) {
c := &Config{f: f}
yd := yaml.NewDecoder(f)
if err := yd.Decode(c); err != nil {
return nil, err
return nil, fmt.Errorf("decode config failed: %s", err)
}

if strings.HasPrefix(c.Core.SaveRoot, "/") {
Expand Down

0 comments on commit fc2c45d

Please sign in to comment.