git-lfs/commands/command_standalone_file.go
brian m. carlson bb05cf5053
Provide support for file URLs via a transfer agent
One commonly requested feature for Git LFS is support for local files.
Currently, we tell users that they must use a standalone transfer
agent, which is true, but nobody has provided one yet. Since writing a
simple transfer agent is not very difficult, let's provide one
ourselves.

Introduce a basic standalone transfer agent, git lfs standalone-file,
that handles uploads and downloads. Add a default configuration required
for it to work, while still allowing users to override this
configuration if they have a preferred implementation that is more
featureful. We provide this as a transfer agent instead of built-in
because it avoids the complexity of adding a different code path to the
main codebase, but also serves as a demonstration of how to write a
standalone transfer agent for others who might want to do so, much
like Git demonstrates remote helpers using its HTTP helper.
2019-08-02 17:23:47 +00:00

22 lines
405 B
Go

package commands
import (
"fmt"
"os"
"github.com/git-lfs/git-lfs/lfshttp/standalone"
"github.com/spf13/cobra"
)
func standaloneFileCommand(cmd *cobra.Command, args []string) {
err := standalone.ProcessStandaloneData(cfg, os.Stdin, os.Stdout)
if err != nil {
fmt.Fprintln(os.Stderr, err.Error())
os.Exit(2)
}
}
func init() {
RegisterCommand("standalone-file", standaloneFileCommand, nil)
}