ssh

package
v1.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 23, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RootCmd = &cobra.Command{
	Use:  "ssh",
	Args: cobra.NoArgs,

	RunE: func(cmd *cobra.Command, args []string) (err error) {
		defer try.Handle(&err)
		prefix := try.E1(cmd.Flags().GetString("prefix"))
		home := try.E1(os.UserHomeDir())
		targetDirectory := filepath.Join(home, ".ssh")

		configSrc := filepath.Join(prefix, "ssh", "config")
		if try.E1(pa.Exists(configSrc)) {
			try.E(ex.Command("install", "-D", "--mode", "u=rw,go=r", "--target-directory", targetDirectory, configSrc).Bind().Run())
		}
		for _, keyType := range keyTypes {
			keySrc := filepath.Join(prefix, "ssh", "id_"+keyType)
			pubKeySrc := keySrc + ".pub"
			if try.E1(pa.Exists(keySrc)) {
				try.E(ex.Command("install", "-D", "--mode", "u=rw,go=", "--target-directory", targetDirectory, keySrc).Bind().Run())
				try.E(ex.Command("install", "-D", "--mode", "u=rw,go=r", "--target-directory", targetDirectory, pubKeySrc).Bind().Run())
			}
		}

		return nil
	},
}

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL