Skip to content

Commit

Permalink
Android os (#13)
Browse files Browse the repository at this point in the history
* update readme file

* support andorid OS support to configure data folder

* add switch OS configuration steps to README
  • Loading branch information
isacikgoz authored May 11, 2019
1 parent daae0ae commit 3710fb2
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,17 @@ brew tap isacikgoz/taps
brew install isacikgoz/taps/tldr
```

## Use for different OS
You can use tldr++ for another OS by setting `TLDR_OS` envrionment to your desired OS such as `linux`, `windows`, `osx` etc.

Let's say you want to set it to Linux run the following command:

```bash
export TLDR_OS=linux
```

To make it permenant, you can add the line above to your shell rc file (e.g. `bashrc`, `zshrc` etc.)

## Credits
- [tldr-pages](https://github.com/tldr-pages/tldr)
- [survey](https://github.com/AlecAivazis/survey)
Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ var (

func main() {

kingpin.Version("tldr++ version 0.6.0")
kingpin.Version("tldr++ version 0.6.1")
kingpin.Parse()

config.StartUp(*clear, *update)
Expand Down
6 changes: 2 additions & 4 deletions pkg/config/source.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,17 +67,15 @@ func PullSource() error {
return err
}

// returns OS dependent data dir. see XDG Base Directory Specification:
// DataDir returns OS dependent data dir. see XDG Base Directory Specification:
// https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
func DataDir() (d string) {
switch osname := runtime.GOOS; osname {
case "windows":
d = os.Getenv("APPDATA")
case "darwin":
d = os.Getenv("HOME") + "/Library/Application Support"
case "linux":
d = os.Getenv("HOME") + "/.local/share"
case "solaris":
case "linux", "android", "solaris":
d = os.Getenv("HOME") + "/.local/share"
default:
fmt.Println("Operating system couldn't be recognized")
Expand Down

0 comments on commit 3710fb2

Please sign in to comment.