Skip to content

Commit

Permalink
Added documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
cgxeiji committed Nov 4, 2018
1 parent d9047e4 commit 96217d7
Show file tree
Hide file tree
Showing 8 changed files with 136 additions and 27 deletions.
107 changes: 107 additions & 0 deletions scholar/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
# Scholar: a CLI Reference Manager

Scholar is a terminal based reference manager written in Go, that helps you
keep track of your resources. It uses YAML files to save the metadata. Entry
types and fields are taken from the [BibLaTex
format](http://mirrors.ctan.org/macros/latex/contrib/biblatex/doc/biblatex.pdf).
It was inspired by [papis](https://github.com/papis/papis), a CLI reference
manager written in python.

## Features

Add any file using:
```
$ scholar add filename.ext
```

Specify DOI or search for metadata on the web (currently only support for CrossRef):
```
$ scholar add filename.ext --doi=10.1007/978-94-011-6022-3_3
$ scholar add general theory of relativity einstein 1992
```

Use multiple libraries for different types of entries:
```
$ scholar open einstein --library=research
$ scholar add Harry Potter.epub --library=books
```

And much more:
```
$ scholar help
Scholar: a CLI Reference Manager
Scholar is a CLI reference manager that keeps track of
your documents metadata using YAML files with biblatex format.
Usage:
scholar [flags]
scholar [command]
Available Commands:
add Add a new entry
config Configure Scholar
edit Edit an entry
export Export entries
help Help about any command
import Import a bibtex/biblatex file
open Open an entry
remove Remove an entry
Flags:
-h, --help help for scholar
-l, --library string specify the library
Use "scholar [command] --help" for more information about a command.
```

## Installation

If you do not have Go installed, follow this guide:

- [The Go Programming Language: Getting Started](https://golang.org/doc/install)

Then, run:
```
go get -u github.com/cgxeiji/scholar/scholar
```

Done!

## TODO

### General

- [ ] Add `-i` flag to enable/disable interactive mode.
- [ ] Add `interactive: true` settings in the configuration file.
- [ ] Make attached file path relative to entry, unless is an external file.
- [ ] Be able to reference a file instead of copying it.
- [ ] Add support for attaching multiple files.

### Add

- [ ] Add a flag for manual/auto input of metadata.

### Config

- [ ] Add function to create a local configuration file.

### Export

- [ ] Add different export formats.

### Open

- [ ] Add selection menu if multiple files are attached.
- [ ] Open metadata if no file/url/DOI is attached.

### Remove

- [ ] Add remove confirmation.

## License

MIT
11 changes: 8 additions & 3 deletions scholar/cmd/add.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,15 @@ import (
// addCmd represents the add command
var addCmd = &cobra.Command{
Use: "add [FILENAME/QUERY]",
Short: "Adds a new entry",
Long: `Add a new entry to scholar.
Short: "Add a new entry",
Long: `Scholar: a CLI Reference Manager
You can TODO`,
Add a new entry to a library.
--------------------------------------------------------------------------------
TODO: Add a flag for manual/auto input of metadata
--------------------------------------------------------------------------------
`,
Run: func(cmd *cobra.Command, args []string) {
var entry *scholar.Entry

Expand Down
3 changes: 1 addition & 2 deletions scholar/cmd/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import (
// configCmd represents the config command
var configCmd = &cobra.Command{
Use: "config",
Short: "Configures Scholar",
Short: "Configure Scholar",
Long: `Scholar: a CLI Reference Manager
Configure and modify the settings of Scholar.
Expand All @@ -43,7 +43,6 @@ in the current directory, or at the default
location.
If there is no configuration file available,
of if it is the first time running this command,
a configuration file will be created at:
$HOME/.config/scholar/config.yaml
Expand Down
6 changes: 1 addition & 5 deletions scholar/cmd/edit.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,10 @@ import (
// editCmd represents the edit command
var editCmd = &cobra.Command{
Use: "edit",
Short: "Edits an entry",
Short: "Edit an entry",
Long: `Scholar: a CLI Reference Manager
Edit an entry's metadata using the default's text editor.
--------------------------------------------------------------------------------
TODO:
--------------------------------------------------------------------------------
`,
Run: func(cmd *cobra.Command, args []string) {
if entry := guiQuery(entryList(), strings.Join(args, " ")); entry != nil {
Expand Down
3 changes: 1 addition & 2 deletions scholar/cmd/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import (
// exportCmd represents the export command
var exportCmd = &cobra.Command{
Use: "export",
Short: "Exports entries",
Short: "Export entries",
Long: `Scholar: a CLI Reference Manager
Print all entries to stdout using biblatex format.
Expand All @@ -45,7 +45,6 @@ To save to a file run:
--------------------------------------------------------------------------------
TODO: add different export formats
TODO: add flag to specify which library to export
--------------------------------------------------------------------------------
`,
Run: func(cmd *cobra.Command, args []string) {
Expand Down
7 changes: 3 additions & 4 deletions scholar/cmd/import.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,11 @@ import (
// importCmd represents the import command
var importCmd = &cobra.Command{
Use: "import",
Short: "Imports a bibtex/biblatex file",
Short: "Import a bibtex/biblatex file",
Long: `Scholar: a CLI Reference Manager
Import a bibtex/biblatex file into a library in Scholar.
`,
Import a bibtex/biblatex file into a library.
`,
Run: func(cmd *cobra.Command, args []string) {
if len(args) > 0 {
importParse(args[0])
Expand Down
12 changes: 7 additions & 5 deletions scholar/cmd/open.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,21 @@ import (

// openCmd represents the open command
var openCmd = &cobra.Command{
Use: "open [KEY]",
Short: "Opens an entry",
Use: "open [SEARCH]",
Short: "Open an entry",
Long: `Scholar: a CLI Reference Manager
Open an entry's attached file with the default system's software.
If no file is attached, it opens the entry's url.
If no url is available, it opens the entry's DOI.
To search for an entry run:
To select an entry from the database run:
scholar open
to specify which entry to open run:
To specify which entry to open run:
scholar open KEY
scholar open SEARCH TERM
--------------------------------------------------------------------------------
TODO: if there are multiple files attached, a selection menu appears.
Expand Down
14 changes: 8 additions & 6 deletions scholar/cmd/remove.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,15 @@ import (
// removeCmd represents the remove command
var removeCmd = &cobra.Command{
Use: "remove",
Short: "A brief description of your command",
Long: `A longer description that spans multiple lines and likely contains examples
and usage of using your command. For example:
Short: "Remove an entry",
Long: `Scholar: a CLI Reference Manager
Cobra is a CLI library for Go that empowers applications.
This application is a tool to generate the needed files
to quickly create a Cobra application.`,
Remove an entry from the library.
--------------------------------------------------------------------------------
TODO: Add remove confirmation
--------------------------------------------------------------------------------
`,
Run: func(cmd *cobra.Command, args []string) {
if entry := guiQuery(entryList(), strings.Join(args, " ")); entry != nil {
path := filepath.Join(libraryPath(), entry.GetKey())
Expand Down

0 comments on commit 96217d7

Please sign in to comment.