Skip to content

Commit b69f47f

Browse files
authored
Merge pull request #3276 from Hofer-Julian/add-pixi
pixi: added completer with dynamic completions
2 parents 0b1df64 + 44216fd commit b69f47f

File tree

346 files changed

+7268
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

346 files changed

+7268
-0
lines changed
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
package cmd
2+
3+
import (
4+
"github.com/carapace-sh/carapace"
5+
"github.com/carapace-sh/carapace-bin/pkg/actions/tools/pixi"
6+
"github.com/spf13/cobra"
7+
)
8+
9+
var addCmd = &cobra.Command{
10+
Use: "add",
11+
Short: "Adds dependencies to the workspace",
12+
Aliases: []string{"a"},
13+
Run: func(cmd *cobra.Command, args []string) {},
14+
}
15+
16+
func init() {
17+
carapace.Gen(addCmd).Standalone()
18+
19+
addCmd.Flags().String("auth-file", "", "Path to the file containing the authentication token")
20+
addCmd.Flags().String("branch", "", "The git branch")
21+
addCmd.Flags().String("concurrent-downloads", "", "Max concurrent network requests, default is `50`")
22+
addCmd.Flags().String("concurrent-solves", "", "Max concurrent solves, default is the number of CPUs")
23+
addCmd.Flags().Bool("editable", false, "Whether the pypi requirement should be editable")
24+
addCmd.Flags().StringP("feature", "f", "", "The feature for which the dependency should be modified")
25+
addCmd.Flags().Bool("frozen", false, "Install the environment as defined in the lockfile, doesn't update lockfile if it isn't up-to-date with the manifest file")
26+
addCmd.Flags().StringP("git", "g", "", "The git url to use when adding a git dependency")
27+
addCmd.Flags().Bool("locked", false, "Check if lockfile is up-to-date before installing the environment, aborts when lockfile isn't up-to-date with the manifest file")
28+
addCmd.Flags().Bool("no-install", false, "Don't modify the environment, only modify the lock-file")
29+
addCmd.Flags().String("pinning-strategy", "", "Set pinning strategy")
30+
addCmd.Flags().StringSliceP("platform", "p", nil, "The platform for which the dependency should be modified")
31+
addCmd.Flags().Bool("pypi", false, "The specified dependencies are pypi dependencies. Conflicts with `host` and `build`")
32+
addCmd.Flags().String("pypi-keyring-provider", "", "Specifies whether to use the keyring to look up credentials for PyPI")
33+
addCmd.Flags().String("rev", "", "The git revision")
34+
addCmd.Flags().Bool("run-post-link-scripts", false, "Run post-link scripts (insecure)")
35+
addCmd.Flags().StringP("subdir", "s", "", "The subdirectory of the git repository to use")
36+
addCmd.Flags().String("tag", "", "The git tag")
37+
addCmd.Flags().Bool("tls-no-verify", false, "Do not verify the TLS certificate of the server")
38+
addCmd.Flags().String("tls-root-certs", "", "Which TLS root certificates to use: 'webpki' (bundled Mozilla roots), 'native' (system store), or 'all' (both)")
39+
addCmd.Flags().Bool("use-environment-activation-cache", false, "Use environment activation cache (experimental)")
40+
rootCmd.AddCommand(addCmd)
41+
42+
carapace.Gen(addCmd).FlagCompletion(carapace.ActionMap{
43+
"auth-file": carapace.ActionFiles(),
44+
"feature": pixi.ActionFeatures(),
45+
"pinning-strategy": carapace.ActionValues("semver", "minor", "major", "latest-up", "exact-version", "no-pin"),
46+
"platform": pixi.ActionPlatforms(),
47+
"pypi-keyring-provider": carapace.ActionValues("disabled", "subprocess"),
48+
})
49+
50+
carapace.Gen(addCmd).PositionalAnyCompletion(
51+
pixi.ActionPackageSearch(),
52+
)
53+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package cmd
2+
3+
import (
4+
"github.com/carapace-sh/carapace"
5+
"github.com/spf13/cobra"
6+
)
7+
8+
var authCmd = &cobra.Command{
9+
Use: "auth",
10+
Short: "Login to prefix.dev or anaconda.org servers to access private channels",
11+
Run: func(cmd *cobra.Command, args []string) {},
12+
}
13+
14+
func init() {
15+
carapace.Gen(authCmd).Standalone()
16+
17+
rootCmd.AddCommand(authCmd)
18+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package cmd
2+
3+
import (
4+
"github.com/carapace-sh/carapace"
5+
"github.com/spf13/cobra"
6+
)
7+
8+
var auth_helpCmd = &cobra.Command{
9+
Use: "help",
10+
Short: "Print this message or the help of the given subcommand(s)",
11+
Run: func(cmd *cobra.Command, args []string) {},
12+
}
13+
14+
func init() {
15+
carapace.Gen(auth_helpCmd).Standalone()
16+
17+
authCmd.AddCommand(auth_helpCmd)
18+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package cmd
2+
3+
import (
4+
"github.com/carapace-sh/carapace"
5+
"github.com/spf13/cobra"
6+
)
7+
8+
var auth_help_helpCmd = &cobra.Command{
9+
Use: "help",
10+
Short: "Print this message or the help of the given subcommand(s)",
11+
Run: func(cmd *cobra.Command, args []string) {},
12+
}
13+
14+
func init() {
15+
carapace.Gen(auth_help_helpCmd).Standalone()
16+
17+
auth_helpCmd.AddCommand(auth_help_helpCmd)
18+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package cmd
2+
3+
import (
4+
"github.com/carapace-sh/carapace"
5+
"github.com/spf13/cobra"
6+
)
7+
8+
var auth_help_loginCmd = &cobra.Command{
9+
Use: "login",
10+
Short: "Store authentication information for a given host",
11+
Run: func(cmd *cobra.Command, args []string) {},
12+
}
13+
14+
func init() {
15+
carapace.Gen(auth_help_loginCmd).Standalone()
16+
17+
auth_helpCmd.AddCommand(auth_help_loginCmd)
18+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package cmd
2+
3+
import (
4+
"github.com/carapace-sh/carapace"
5+
"github.com/spf13/cobra"
6+
)
7+
8+
var auth_help_logoutCmd = &cobra.Command{
9+
Use: "logout",
10+
Short: "Remove authentication information for a given host",
11+
Run: func(cmd *cobra.Command, args []string) {},
12+
}
13+
14+
func init() {
15+
carapace.Gen(auth_help_logoutCmd).Standalone()
16+
17+
auth_helpCmd.AddCommand(auth_help_logoutCmd)
18+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package cmd
2+
3+
import (
4+
"github.com/carapace-sh/carapace"
5+
"github.com/spf13/cobra"
6+
)
7+
8+
var auth_loginCmd = &cobra.Command{
9+
Use: "login",
10+
Short: "Store authentication information for a given host",
11+
Run: func(cmd *cobra.Command, args []string) {},
12+
}
13+
14+
func init() {
15+
carapace.Gen(auth_loginCmd).Standalone()
16+
17+
auth_loginCmd.Flags().String("conda-token", "", "The token to use on anaconda.org / quetz authentication")
18+
auth_loginCmd.Flags().String("password", "", "The password to use (for basic HTTP authentication)")
19+
auth_loginCmd.Flags().String("s3-access-key-id", "", "The S3 access key ID")
20+
auth_loginCmd.Flags().String("s3-secret-access-key", "", "The S3 secret access key")
21+
auth_loginCmd.Flags().String("s3-session-token", "", "The S3 session token")
22+
auth_loginCmd.Flags().String("token", "", "The token to use (for authentication with prefix.dev)")
23+
auth_loginCmd.Flags().String("username", "", "The username to use (for basic HTTP authentication)")
24+
authCmd.AddCommand(auth_loginCmd)
25+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package cmd
2+
3+
import (
4+
"github.com/carapace-sh/carapace"
5+
"github.com/spf13/cobra"
6+
)
7+
8+
var auth_logoutCmd = &cobra.Command{
9+
Use: "logout",
10+
Short: "Remove authentication information for a given host",
11+
Run: func(cmd *cobra.Command, args []string) {},
12+
}
13+
14+
func init() {
15+
carapace.Gen(auth_logoutCmd).Standalone()
16+
17+
authCmd.AddCommand(auth_logoutCmd)
18+
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
package cmd
2+
3+
import (
4+
"github.com/carapace-sh/carapace"
5+
"github.com/spf13/cobra"
6+
)
7+
8+
var buildCmd = &cobra.Command{
9+
Use: "build",
10+
Short: "Build a conda package from a Pixi package.",
11+
Run: func(cmd *cobra.Command, args []string) {},
12+
}
13+
14+
func init() {
15+
carapace.Gen(buildCmd).Standalone()
16+
17+
buildCmd.Flags().Bool("as-is", false, "Shorthand for the combination of --no-install and --frozen")
18+
buildCmd.Flags().String("auth-file", "", "Path to the file containing the authentication token")
19+
buildCmd.Flags().StringP("build-dir", "b", "", "The directory to use for incremental builds artifacts")
20+
buildCmd.Flags().String("build-platform", "", "The build platform to use for building (defaults to the current platform)")
21+
buildCmd.Flags().BoolP("clean", "c", false, "Whether to clean the build directory before building")
22+
buildCmd.Flags().String("concurrent-downloads", "", "Max concurrent network requests, default is `50`")
23+
buildCmd.Flags().String("concurrent-solves", "", "Max concurrent solves, default is the number of CPUs")
24+
buildCmd.Flags().Bool("frozen", false, "Install the environment as defined in the lockfile, doesn't update lockfile if it isn't up-to-date with the manifest file")
25+
buildCmd.Flags().Bool("locked", false, "Check if lockfile is up-to-date before installing the environment, aborts when lockfile isn't up-to-date with the manifest file")
26+
buildCmd.Flags().Bool("no-install", false, "Don't modify the environment, only modify the lock-file")
27+
buildCmd.Flags().StringP("output-dir", "o", "", "The output directory to place the built artifacts")
28+
buildCmd.Flags().String("path", "", "The path to a directory containing a package manifest, or to a specific manifest file")
29+
buildCmd.Flags().String("pinning-strategy", "", "Set pinning strategy")
30+
buildCmd.Flags().String("pypi-keyring-provider", "", "Specifies whether to use the keyring to look up credentials for PyPI")
31+
buildCmd.Flags().Bool("run-post-link-scripts", false, "Run post-link scripts (insecure)")
32+
buildCmd.Flags().StringP("target-platform", "t", "", "The target platform to build for (defaults to the current platform)")
33+
buildCmd.Flags().Bool("tls-no-verify", false, "Do not verify the TLS certificate of the server")
34+
buildCmd.Flags().String("tls-root-certs", "", "Which TLS root certificates to use: 'webpki' (bundled Mozilla roots), 'native' (system store), or 'all' (both)")
35+
buildCmd.Flags().Bool("use-environment-activation-cache", false, "Use environment activation cache (experimental)")
36+
rootCmd.AddCommand(buildCmd)
37+
38+
carapace.Gen(buildCmd).FlagCompletion(carapace.ActionMap{
39+
"auth-file": carapace.ActionFiles(),
40+
"build-dir": carapace.ActionDirectories(),
41+
"output-dir": carapace.ActionDirectories(),
42+
"path": carapace.ActionFiles(),
43+
"pinning-strategy": carapace.ActionValues("semver", "minor", "major", "latest-up", "exact-version", "no-pin"),
44+
"pypi-keyring-provider": carapace.ActionValues("disabled", "subprocess"),
45+
})
46+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package cmd
2+
3+
import (
4+
"github.com/carapace-sh/carapace"
5+
"github.com/carapace-sh/carapace-bin/pkg/actions/tools/pixi"
6+
"github.com/spf13/cobra"
7+
)
8+
9+
var cleanCmd = &cobra.Command{
10+
Use: "clean",
11+
Short: "Cleanup the environments",
12+
Run: func(cmd *cobra.Command, args []string) {},
13+
}
14+
15+
func init() {
16+
carapace.Gen(cleanCmd).Standalone()
17+
18+
cleanCmd.Flags().Bool("activation-cache", false, "Only remove the activation cache")
19+
cleanCmd.Flags().Bool("build", false, "Only remove the pixi-build cache")
20+
cleanCmd.Flags().StringP("environment", "e", "", "The environment directory to remove")
21+
rootCmd.AddCommand(cleanCmd)
22+
23+
carapace.Gen(cleanCmd).FlagCompletion(carapace.ActionMap{
24+
"environment": pixi.ActionEnvironments(),
25+
})
26+
}

0 commit comments

Comments
 (0)