Skip to content

Commit

Permalink
Correctly unpack project and version from args in push command
Browse files Browse the repository at this point in the history
  • Loading branch information
timofurrer committed Oct 17, 2021
1 parent 38d5eae commit 29eafe9
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions cmd/push.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ Upload documentation to specific docat server:
project := viper.GetString("project")
version := viper.GetString("version")

if util.IsDirectory(docsPath) {
unpackArgs := func() (string, string) {
if project == "" {
if len(args) < 2 {
log.Fatalf("when PROJECT is not given, the DOCATL_PROJECT variable must contain it")
Expand All @@ -65,6 +65,13 @@ Upload documentation to specific docat server:
}
}

return project, version
}

if util.IsDirectory(docsPath) {

project, version = unpackArgs()

docsPathBuilt, err := docatl.Build(docsPath, docatl.BuildMetadata{
Host: docat.Host,
Project: project,
Expand All @@ -87,9 +94,7 @@ Upload documentation to specific docat server:
project = meta.Project
version = meta.Version

if project == "" || version == "" {
log.Fatal("when PROJECT and VERSION are not given, the `.docatl.meta.yaml` file in the archive must contain them. Use `docatl build` to make sure it exists")
}
project, version = unpackArgs()
}

ensureHost()
Expand Down

0 comments on commit 29eafe9

Please sign in to comment.