Skip to content

Commit

Permalink
fix: upload entire directories
Browse files Browse the repository at this point in the history
  • Loading branch information
justmiles committed Nov 29, 2019
1 parent 0061bba commit 3b84b2e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 11 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ Download the [latest release](https://github.com/justmiles/go-markdown2confluenc

- Linux

curl -LO https://github.com/justmiles/go-markdown2confluence/releases/download/v3.0.0/markdown2confluence_3.0.0_linux_x86_64.tar.gz
sudo tar -xzvf markdown2confluence_3.0.0_linux_x86_64.tar.gz -C /usr/local/bin/ markdown2confluence
curl -LO https://github.com/justmiles/go-markdown2confluence/releases/download/v3.0.1/markdown2confluence_3.0.1_linux_x86_64.tar.gz
sudo tar -xzvf markdown2confluence_3.0.1_linux_x86_64.tar.gz -C /usr/local/bin/ markdown2confluence

- OSX

curl -LO https://github.com/justmiles/go-markdown2confluence/releases/download/v3.0.0/markdown2confluence_3.0.0_darwin_x86_64.tar.gz
sudo tar -xzvf markdown2confluence_3.0.0_linux_x86_64.tar.gz -C /usr/local/bin/ markdown2confluence
curl -LO https://github.com/justmiles/go-markdown2confluence/releases/download/v3.0.1/markdown2confluence_3.0.1_darwin_x86_64.tar.gz
sudo tar -xzvf markdown2confluence_3.0.1_linux_x86_64.tar.gz -C /usr/local/bin/ markdown2confluence

- Windows
- Download [the latest release](https://github.com/justmiles/go-markdown2confluence/releases/download/v3.0.0/markdown2confluence_3.0.0_windows_x86_64.zip) and add to your system `PATH`
- Download [the latest release](https://github.com/justmiles/go-markdown2confluence/releases/download/v3.0.1/markdown2confluence_3.0.1_windows_x86_64.zip) and add to your system `PATH`

## Environment Variables
For best practice we recommend you [authenticate using an API token](https://id.atlassian.com/manage/api-tokens).
Expand Down
21 changes: 15 additions & 6 deletions lib/markdown.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,19 @@ func (m *Markdown2Confluence) Run() []error {
}
}

md = MarkdownFile{
md := MarkdownFile{
Path: path,
Parents: strings.Split(filepath.Dir(strings.TrimPrefix(filepath.ToSlash(path), filepath.ToSlash(f))), "/"),
Title: strings.TrimSuffix(filepath.Base(path), ".md"),
}

if m.Parent != "" {
md.Parents = append([]string{m.Parent}, md.Parents...)
md.Parents = deleteEmpty(md.Parents)
}

markdownFiles = append(markdownFiles, md)

}
return nil
})
Expand All @@ -158,14 +166,15 @@ func (m *Markdown2Confluence) Run() []error {
if md.Title == "" {
md.Title = strings.TrimSuffix(filepath.Base(f), ".md")
}
}

if m.Parent != "" {
md.Parents = append([]string{m.Parent}, md.Parents...)
md.Parents = deleteEmpty(md.Parents)
if m.Parent != "" {
md.Parents = append([]string{m.Parent}, md.Parents...)
md.Parents = deleteEmpty(md.Parents)
}

markdownFiles = append(markdownFiles, md)
}

markdownFiles = append(markdownFiles, md)
}

var (
Expand Down

0 comments on commit 3b84b2e

Please sign in to comment.