func handleStage(ctx *cli.Context, client *daemon.Client) error { filePath, err := filepath.Abs(ctx.Args().First()) if err != nil { return ExitCode{ UnknownError, fmt.Sprintf("Unable to make abs path: %v: %v", filePath, err), } } // Assume "/file.png" for file.png as repo path, if none given. repoPath := "/" + filepath.Base(filePath) if ctx.NArg() > 1 { repoPath = ctx.Args()[1] } if err := client.Stage(filePath, repoPath); err != nil { return ExitCode{ UnknownError, fmt.Sprintf("Could not stage file: %v: %v", filePath, err), } } fmt.Println(repoPath) return nil }