Skip to content

Commit

Permalink
For backwards compatibility, read source paths from args
Browse files Browse the repository at this point in the history
  • Loading branch information
brikis98 committed Jun 20, 2016
1 parent 5da5d60 commit 8212c25
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,15 +138,26 @@ func runFetch (c *cli.Context) error {
}

func parseOptions(c *cli.Context) FetchOptions {
localDownloadPath := c.Args().First()
sourcePaths := c.StringSlice(OPTION_SOURCE_PATH)

// Maintain backwards compatibility with older versions of fetch that passed source paths as an optional first
// command-line arg
if c.NArg() == 2 {
fmt.Printf("DEPRECATION WARNING: passing source paths via command-line args is deprecated. Please use the --%s option instead!\n", OPTION_SOURCE_PATH)
sourcePaths = []string{c.Args().First()}
localDownloadPath = c.Args().Get(1)
}

return FetchOptions{
RepoUrl: c.String(OPTION_REPO),
CommitSha: c.String(OPTION_COMMIT),
BranchName: c.String(OPTION_BRANCH),
TagConstraint: c.String(OPTION_TAG),
GithubToken: c.String(OPTION_GITHUB_TOKEN),
SourcePaths: c.StringSlice(OPTION_SOURCE_PATH),
SourcePaths: sourcePaths,
ReleaseAssets: c.StringSlice(OPTION_RELEASE_ASSET),
LocalDownloadPath: c.Args().First(),
LocalDownloadPath: localDownloadPath,
}
}

Expand Down

0 comments on commit 8212c25

Please sign in to comment.