Skip to content

Commit

Permalink
Update README
Browse files Browse the repository at this point in the history
* Usage and installation added.

* URL prefix problem fixed.

Signed-off-by: Gökhan Özeloğlu <[email protected]>
  • Loading branch information
gozeloglu committed Nov 23, 2024
1 parent cfb41ea commit 8b61fb6
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 1 deletion.
44 changes: 44 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1 +1,45 @@
# bm-go

New version of the [bm](https://github.com/gozeloglu/bm) tool written in Go.

## Installation

You can type the following command.

```shell
go install github.com/gozeloglu/bm-go@latest
```

## Usage

Currently, limited commands are provided.

### Save new bookmark

```shell
bm --save https://google.com
```

### List all bookmarks

```shell
bm --list
```

### Delete the bookmark

```shell
bm --delete 3 # deletes the 3rd bookmark
```

### Update the bookmark link

```shell
bm --update 3 https://github.com # updates the 3rd link with new one, github.com in that example
```

### Open link on the browser

```shell
bm --open 3 # opens 3rd link on the default browser
```
5 changes: 5 additions & 0 deletions cmd/bm.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"os"
"os/exec"
"runtime"
"strings"
)

const (
Expand Down Expand Up @@ -127,6 +128,10 @@ func main() {

// openBrowser opens the given url in default browser.
func openBrowser(url string) bool {
if !strings.HasPrefix(url, "https://") || !strings.HasPrefix(url, "http://") {
url = "https://" + url
}
fmt.Println(url)
var args []string
switch runtime.GOOS {
case "darwin":
Expand Down
2 changes: 1 addition & 1 deletion docs/design.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ bm --save <link>
bm --list # list all of the bookmarked links
bm --delete <ith bookmark> # delete the ith bookmarked
bm --update i <new link> # update the ith bookmark with new link
bm open i # open given link id in default browser
bm --open i # open given link id in default browser
bm --help # prints usage
bm --version # prints version
```

0 comments on commit 8b61fb6

Please sign in to comment.