Skip to content

Commit

Permalink
Merge pull request #21 from automoto/update_docs
Browse files Browse the repository at this point in the history
fixed path set via ENV VAR, updated command line options and docs
  • Loading branch information
automoto authored May 10, 2020
2 parents 50f49f6 + eddfebf commit 7215f14
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 43 deletions.
76 changes: 58 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,36 @@

Devlog's goal is to help you create a "Development Log" to reflect and generate notes during and after a coding session.

<!-- MarkdownTOC autolink="true" -->

- [What is a Development Log?](#what-is-a-development-log)
- [What is Devlog?](#what-is-devlog)
- [Install](#install)
- [Install Using Go](#install-using-go)
- [Using Devlog](#using-devlog)
- [Configure](#configure)
- [Configuration using environment variables:](#configuration-using-environment-variables)
- [Configuration using command line options:](#configuration-using-command-line-options)
- [Customizing questions and content of Devlog](#customizing-questions-and-content-of-devlog)
- [Building Locally](#building-locally)
- [Contributing](#contributing)

<!-- /MarkdownTOC -->


#### What is a Development Log?

A development log is a like a software development journal that you fill out during and after a coding session. It's great for reflecting on how coding sessions went, doing brain dumps and documenting TODOs.

Filling out these type of "development logs" and notes about coding sessions is inspired by the [note taking practices of prolific Doom/VR developer John Carmack](https://news.ycombinator.com/item?id=12575501). This can also be useful when paired with a "shutdown routines" at the end of an intense work session to help us mentally disconnect. More about "shutdown routines": [[1]](https://www.calnewport.com/blog/2009/06/08/drastically-reduce-stress-with-a-work-shutdown-ritual/)[[2]](https://www.calnewport.com/blog/2012/08/02/work-less-to-work-better-my-experiments-with-shutdown-routines/).

#### What is Devlog?

Devlog generates a time stamped, simple, "development log" file to a directory you specify. This gives us alot of flexibility, you can save your devlog files into a git repository or to a cloud file service directory like dropbox, google drive, or one drive for automated syncing and backup.
Devlog generates a customizable, time stamped, simple, "development log" markdown file to a directory you specify. This gives us alot of flexibility, you can save your devlog files into a git repository or to a cloud file service directory like dropbox, google drive, or one drive for automated syncing and backup.

Devlog prioritizes:
- Open standards over closed. Keep your notes in markdown files that can be queried for easily in a directory, not locked into some vendors service or custom formatting standards.
- Ease of use and simplicity. This is not meant to be a complex static content generator. It strives to be an easy to configure and create log files to fill out in a text editor of your choice.
- Ease of use and simplicity. This is not meant to be a complex static content generator. It strives to be an easy to configure and create customizable markdown files to fill out in a text editor of your choice.

#### Install
The easiest way to install devlog is to use the provided installation script
Expand All @@ -28,12 +48,12 @@ If you prefer to install it yourself, you can get the latest release binary dire

##### Install Using Go

If you already have an updated verison of go lang, installing via go is easy:
If you already have an updated version of go lang, installing via go is easy:
`go get -u github.com/automoto/devlog/`


#### Using Devlog
Ideally you will run Devlog during or towards the end of your development session and it will be filled out with your notes and answers to the questions when your finished. The "Notes" seciton at the bottom is great for TODOs or other information you want to keep. [Here is an example of a filled out devlog](https://gist.github.com/automoto/15e037d40258df1b8c2394ba1bae2c07).
Ideally you will run Devlog during or towards the end of your development session and it will be filled out with your notes and answers to the questions when your finished. The "Notes" section at the bottom is great for TODOs or other information you want to keep. [Here is an example of a filled out devlog](https://gist.github.com/automoto/15e037d40258df1b8c2394ba1bae2c07).

Devlog is designed to automate generating a development log markdown file for you to fill out in your favorite text editor. Once you have installed it, just type `devlog` and it will generate a time stamped markdown document.

Expand All @@ -46,7 +66,7 @@ devlog -p 'stdout'

```

By default, it returns the path of the document created so you can input this into a text editor easily. Here is a way you can generate a dev log document and open it in some popular text editors:
By default, it returns the path of the document created so you can input this into a text editor easily. Here is a way you can generate a markdown document and open it in some popular text editors:

```shell

Expand All @@ -62,15 +82,21 @@ nano `./devlog | tail -n 1`


#### Configure
By default `devlog` will generate a file in the current directory unless specify the directory via setting the environment variable `DEVLOG_DIR`.
By default `devlog` will generate a markdown file in the current directory unless you specify the directory via setting environment variables or through command line options you set.

*Configuration using environment variables:*
##### Configuration using environment variables:

Set the directory to save devlog files to:
```
export DEVLOG_DIR="/home/your_username/your_directory"
```

Set the default template for your devlog files content:
```
export DEVLOG_CONTENT="/home/your_username/your_directory/custom.gohtml"
```


You can override this by temporarily setting the value when calling devlog

```
Expand All @@ -81,22 +107,28 @@ DEVLOG_DIR="/home/your_username/other_directory" devlog

You can also pass in configurations via command line options. Command line options take precedence over configurations set via environment variables.
```
devlog -p "/home/your_username/your_directory" -c "/home/your_username/your_directory/custom-config.yaml"
devlog -p "/home/your_username/your_directory" -t "/home/your_username/your_directory/custom.gohtml"
```
To view all the possible command line options, just pass in the `-h` command line option for help e.g. `devlog -h`

#### Customizing Questions and Content of Devlog
You can customize the sections of your Devlog by creating a `.yaml` and specifying your custom questions and sections there.
``` yaml
questions:
- "My Custom Question One?"
- "My Custom Question Two?"
other_section:
- "TODO"
#### Customizing questions and content of Devlog
You can customize the content of your markdown document by creating a `.gohtml` file and specifying your custom content there.
``` gohtml
### Development Log
*created: {{.FormattedCurrentTime}}*
##### Notes
**TODO**
- [ ]
- [ ]
```
Then pass in your configuration file to devlog:
*note you will need to include `{{.FormattedCurrentTime}}` in your template for it to work.*

Now you can pass in your configuration file to devlog:
```
devlog -p your_custom_questions_file.yaml
devlog -t your_custom_questions_file.gohtml
```

#### Building Locally
Expand Down Expand Up @@ -125,3 +157,11 @@ Now you can run the command `devlog` from anywhere to generate a new devlog file
devlog
2019/09/02 22:00:32 Successfully saved dev log to directory: /home/dev/null
```

#### Contributing

The `Makefile` has most of the commands you need to build, lint, and run the tests locally.

Fork and create a pull-request if you wish to contribute a fix or improvement to Devlog.

A contributor will build your PR in circle-ci and review the change. Please include unit tests and a description of the change in your pull request.
19 changes: 0 additions & 19 deletions custom_content.gohtml
Original file line number Diff line number Diff line change
@@ -1,27 +1,8 @@
### Development Log
*created: {{.FormattedCurrentTime}}*


##### How did your development session go?



##### Did you learn anything new? If so, what did you learn?



##### What could have gone better?



##### What went well?


---

##### Notes


**TODO**

Priority A
Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

func main() {
outputFlagPtr := flag.String("p", "", "Path to the directory where devlog will save notes to. Only pass in a path to a directory, the file names will be auto-generated.")
templateFlagPtr := flag.String("c", "", "File path to the .yaml config file for customizing your devlog notes.")
templateFlagPtr := flag.String("t", "", "File path to the .gohtml file for customizing your devlog notes.")
flag.Parse()
pkg.Start(*templateFlagPtr, *outputFlagPtr)
}
9 changes: 5 additions & 4 deletions pkg/output.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,18 @@ func (c Content) GenerateMarkdown() string {
return buff.String()
}

func (c Content) GetTemplatePath() string {
if len(c.TemplatePath) >= 1 {
return c.TemplatePath
func getTemplatePath(tmpl string) string {
if len(tmpl) >= 1 {
return tmpl
}
path := os.Getenv("DEVLOG_LOG_CONTENT")
path := os.Getenv("DEVLOG_CONTENT")
if len(path) >= 1 {
return path
}
return ""
}


func getTrimmedOutput(output string) string {
return strings.Trim(output, " ")
}
Expand Down
3 changes: 2 additions & 1 deletion pkg/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,9 @@ func Start(templatePath string, outputDirPath string) {
ct := CurrentTime{}
c := Content{
FormattedCurrentTime: ct.GetCurrentDayAndTime().Format("2006-01-02 15:04:05"),
TemplatePath: templatePath,
TemplatePath: getTemplatePath(templatePath),
}

output := c.GenerateMarkdown()
if checkStdOut(outputDirPath) {
fmt.Printf("%s", output)
Expand Down

0 comments on commit 7215f14

Please sign in to comment.