Skip to content

Commit

Permalink
more cleanup
Browse files Browse the repository at this point in the history
Signed-off-by: Carlos Alexandro Becker <[email protected]>
  • Loading branch information
caarlos0 committed Jul 1, 2024
1 parent 0460fab commit ee6f1f3
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 64 deletions.
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ linters:
- goimports
- goprintffuncname
- gosec
- ifshort
# - ifshort
- misspell
- prealloc
- revive
Expand Down
52 changes: 7 additions & 45 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,9 @@ Glow is a terminal based markdown reader designed from the ground up to bring
out the beauty—and power—of the CLI.

Use it to discover markdown files, read documentation directly on the command
line and stash markdown files to your own private collection, so you can read
them anywhere. Glow will find local markdown files in subdirectories or a local
line. Glow will find local markdown files in subdirectories or a local
Git repository.

By the way, all data stashed is encrypted end-to-end: only you can decrypt it.
More on that below.

## Installation

### Package Manager
Expand Down Expand Up @@ -84,6 +80,7 @@ packages. ARM builds are also available for macOS, Linux, FreeBSD and OpenBSD.
### Go

Or just install it with `go`:

```bash
go install github.com/charmbracelet/glow@latest
```
Expand All @@ -98,27 +95,17 @@ go build

[releases]: https://github.com/charmbracelet/glow/releases


## The TUI

Simply run `glow` without arguments to start the textual user interface and
browse local and stashed markdown. Glow will find local markdown files in the
browse local. Glow will find local markdown files in the
current directory and below or, if you’re in a Git repository, Glow will search
the repo.

Markdown files can be read with Glow's high-performance pager. Most of the
keystrokes you know from `less` are the same, but you can press `?` to list
the hotkeys.

### Stashing

Glow works with the Charm Cloud to allow you to store any markdown files in
your own private collection. You can stash a local document from the Glow TUI by
pressing `s`.

Stashing is private, its contents will not be exposed publicly, and it's
encrypted end-to-end. More on encryption below.

## The CLI

In addition to a TUI, Glow has a CLI for working with Markdown. To format a
Expand All @@ -138,18 +125,6 @@ glow github.com/charmbracelet/glow
glow https://host.tld/file.md
```

### Stashing

You can also stash documents from the CLI:

```bash
glow stash README.md
```

Then, when you run `glow` without arguments will you can browse through your
stashed documents. This is a great way to keep track of things that you need to
reference often.

### Word Wrapping

The `-w` flag lets you set a maximum width at which the output will be wrapped:
Expand Down Expand Up @@ -211,32 +186,19 @@ pager: true
width: 80
```
## 🔒 Encryption: How It Works
Encryption works by issuing symmetric keys (basically a generated password) and
encrypting it with the local SSH public key generated by the open-source
[charm][charmlib] library. That encrypted key is then sent up to our server.
We can’t read it since we don’t have your private key. When you want to decrypt
something or view your stash, that key is downloaded from our server and
decrypted locally using the SSH private key. When you link accounts, the
symmetric key is encrypted for each new public key. This happens on your
machine and not our server, so we never see any unencrypted data.
[charmlib]: https://github.com/charmbracelet/charm
## Feedback
We’d love to hear your thoughts on this project. Feel free to drop us a note!
* [Twitter](https://twitter.com/charmcli)
* [The Fediverse](https://mastodon.social/@charmcli)
* [Discord](https://charm.sh/chat)
- [Twitter](https://twitter.com/charmcli)
- [The Fediverse](https://mastodon.social/@charmcli)
- [Discord](https://charm.sh/chat)
## License
[MIT](https://github.com/charmbracelet/glow/raw/master/LICENSE)
***
---
Part of [Charm](https://charm.sh).
Expand Down
2 changes: 0 additions & 2 deletions config_cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ import (

const defaultConfig = `# style name or JSON path (default "auto")
style: "auto"
# show local files only; no network (TUI-mode only)
local: false
# mouse support (TUI-mode only)
mouse: false
# use pager to display markdown
Expand Down
2 changes: 0 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -373,9 +373,7 @@ func init() {
// Config bindings
_ = viper.BindPFlag("style", rootCmd.Flags().Lookup("style"))
_ = viper.BindPFlag("width", rootCmd.Flags().Lookup("width"))
_ = viper.BindPFlag("local", rootCmd.Flags().Lookup("local"))
_ = viper.BindPFlag("debug", rootCmd.Flags().Lookup("debug"))
_ = viper.BindPFlag("news", rootCmd.Flags().Lookup("news"))
_ = viper.BindPFlag("stash", rootCmd.Flags().Lookup("stash"))
_ = viper.BindPFlag("mouse", rootCmd.Flags().Lookup("mouse"))
viper.SetDefault("style", glamour.AutoStyle)
Expand Down
4 changes: 1 addition & 3 deletions ui/editor.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ func openEditor(path string) tea.Cmd {
}
cmd, err := editor.Cmd("glow", path)
if err != nil {
return func() tea.Msg {
return cb(err)
}
return func() tea.Msg { return cb(err) }
}
return tea.ExecProcess(cmd, cb)
}
11 changes: 0 additions & 11 deletions ui/stashhelp.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,6 @@ func (m stashModel) helpView() (string, int) {
}

var (
isStashed bool
isNews bool
isStashable bool
isEditable bool
navHelp []string
filterHelp []string
Expand Down Expand Up @@ -138,14 +135,6 @@ func (m stashModel) helpView() (string, int) {
}
}

if isStashed {
selectionHelp = []string{"s", "stash", "x", "delete", "n", "new", "m", "memo"}
} else if isStashable {
selectionHelp = []string{"s", "stash", "n", "new"}
} else if isNews {
selectionHelp = []string{"x", "dismiss"}
}

if isEditable {
editHelp = []string{"e", "edit"}
}
Expand Down

0 comments on commit ee6f1f3

Please sign in to comment.