From 8212c2508321c91a56e71e3155843d054f77ea4a Mon Sep 17 00:00:00 2001 From: Yevgeniy Brikman Date: Mon, 20 Jun 2016 14:25:01 -0400 Subject: [PATCH] For backwards compatibility, read source paths from args --- main.go | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index 7267f2d..7f788d3 100644 --- a/main.go +++ b/main.go @@ -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, } }