Skip to content

Commit

Permalink
Merge pull request #451 from rsteube/git-archive
Browse files Browse the repository at this point in the history
git: added archive
  • Loading branch information
rsteube authored Jul 8, 2021
2 parents c3dd9b1 + 98d5b6b commit 7881857
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 27 deletions.
53 changes: 53 additions & 0 deletions completers/git_completer/cmd/archive.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package cmd

import (
"github.com/rsteube/carapace"
"github.com/rsteube/carapace-bin/pkg/actions/git"
"github.com/spf13/cobra"
)

var archiveCmd = &cobra.Command{
Use: "archive",
Short: "Create an archive of files from a named tree",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(archiveCmd).Standalone()

archiveCmd.Flags().BoolS("0", "0", false, "set compression level")
archiveCmd.Flags().BoolS("1", "1", false, "set compression level")
archiveCmd.Flags().BoolS("2", "2", false, "set compression level")
archiveCmd.Flags().BoolS("3", "3", false, "set compression level")
archiveCmd.Flags().BoolS("4", "4", false, "set compression level")
archiveCmd.Flags().BoolS("5", "5", false, "set compression level")
archiveCmd.Flags().BoolS("6", "6", false, "set compression level")
archiveCmd.Flags().BoolS("7", "7", false, "set compression level")
archiveCmd.Flags().BoolS("8", "8", false, "set compression level")
archiveCmd.Flags().BoolS("9", "9", false, "set compression level")
archiveCmd.Flags().String("add-file", "", "add untracked file to archive")
archiveCmd.Flags().String("exec", "", "path to the remote git-upload-archive command")
archiveCmd.Flags().String("format", "", "archive format")
archiveCmd.Flags().BoolP("list", "l", false, "list supported archive formats")
archiveCmd.Flags().StringP("output", "o", "", "write the archive to this file")
archiveCmd.Flags().String("prefix", "", "prepend prefix to each pathname in the archive")
archiveCmd.Flags().String("remote", "", "retrieve the archive from remote repository <repo>")
archiveCmd.Flags().BoolP("verbose", "v", false, "report archived files on stderr")
archiveCmd.Flags().Bool("worktree-attributes", false, "read .gitattributes in working directory")
rootCmd.AddCommand(archiveCmd)

carapace.Gen(archiveCmd).FlagCompletion(carapace.ActionMap{
"add-file": carapace.ActionFiles(),
"format": carapace.ActionValues("tar", "zip"),
"output": carapace.ActionFiles(),
"remote": git.ActionRemotes(),
})

carapace.Gen(archiveCmd).PositionalCompletion(
git.ActionRefs(git.RefOptionDefault),
)

carapace.Gen(archiveCmd).PositionalAnyCompletion(
carapace.ActionDirectories(), // TODO shouldn't thi bee the path from the ref?
)
}
27 changes: 0 additions & 27 deletions completers/git_completer/cmd/archive_generated.go

This file was deleted.

0 comments on commit 7881857

Please sign in to comment.