aboutsummaryrefslogtreecommitdiff
path: root/cmd/fscrypt
diff options
context:
space:
mode:
authorebiggers <ebiggers@google.com>2019-09-08 19:46:59 -0700
committerJoseph Richey <joerichey@google.com>2019-09-08 19:46:59 -0700
commit6445dad7d66fa6a1867090fcd9602c98863649f6 (patch)
treec0e5209f018a50ee8b0a1277cc7b06266eff18c1 /cmd/fscrypt
parent28b29d1c97ffd97671186b5e1fae37b64424f9ee (diff)
Fix various typos and grammatical errors (#141)
These were found by a combination of manual review and a custom script that checks for common errors. Also removed an outdated sentence from the comment for setupBefore().
Diffstat (limited to 'cmd/fscrypt')
-rw-r--r--cmd/fscrypt/commands.go14
-rw-r--r--cmd/fscrypt/errors.go8
-rw-r--r--cmd/fscrypt/format.go6
-rw-r--r--cmd/fscrypt/fscrypt.go6
-rw-r--r--cmd/fscrypt/prompt.go2
-rw-r--r--cmd/fscrypt/protector.go2
-rw-r--r--cmd/fscrypt/setup.go2
-rw-r--r--cmd/fscrypt/status.go2
-rw-r--r--cmd/fscrypt/strings.go2
9 files changed, 21 insertions, 23 deletions
diff --git a/cmd/fscrypt/commands.go b/cmd/fscrypt/commands.go
index 54e67ac..f70ba46 100644
--- a/cmd/fscrypt/commands.go
+++ b/cmd/fscrypt/commands.go
@@ -35,7 +35,7 @@ import (
"github.com/google/fscrypt/util"
)
-// Setup is a command which can to global or per-filesystem initialization.
+// Setup is a command which can do global or per-filesystem initialization.
var Setup = cli.Command{
Name: "setup",
ArgsUsage: fmt.Sprintf("[%s]", mountpointArg),
@@ -225,7 +225,7 @@ func checkEncryptable(ctx *actions.Context, path string) error {
}
// selectOrCreateProtector uses user input (or flags) to either create a new
-// protector or select and existing one. The boolean return value is true if we
+// protector or select an existing one. The boolean return value is true if we
// created a new protector.
func selectOrCreateProtector(ctx *actions.Context) (*actions.Protector, bool, error) {
if protectorFlag.Value != "" {
@@ -393,7 +393,7 @@ func purgeAction(c *cli.Context) error {
if err = security.DropFilesystemCache(); err != nil {
return newExitError(c, err)
}
- fmt.Fprintf(c.App.Writer, "Encrypted data removed filesystem cache.\n")
+ fmt.Fprintf(c.App.Writer, "Encrypted data removed from filesystem cache.\n")
} else {
fmt.Fprintf(c.App.Writer, "Filesystem %q should now be unmounted.\n", ctx.Mount.Path)
}
@@ -481,7 +481,7 @@ var Metadata = cli.Command{
(4) Changing the protector protecting a policy using the
"add-protector-to-policy" and "remove-protector-from-policy"
subcommands.`,
- Subcommands: []cli.Command{createMetadata, destoryMetadata, changePassphrase,
+ Subcommands: []cli.Command{createMetadata, destroyMetadata, changePassphrase,
addProtectorToPolicy, removeProtectorFromPolicy, dumpMetadata},
}
@@ -596,7 +596,7 @@ func createPolicyAction(c *cli.Context) error {
return nil
}
-var destoryMetadata = cli.Command{
+var destroyMetadata = cli.Command{
Name: "destroy",
ArgsUsage: fmt.Sprintf("[%s | %s | %s]", shortDisplay(protectorFlag),
shortDisplay(policyFlag), mountpointArg),
@@ -623,10 +623,10 @@ var destoryMetadata = cli.Command{
shortDisplay(protectorFlag), shortDisplay(policyFlag),
mountpointArg),
Flags: []cli.Flag{protectorFlag, policyFlag, forceFlag},
- Action: destoryMetadataAction,
+ Action: destroyMetadataAction,
}
-func destoryMetadataAction(c *cli.Context) error {
+func destroyMetadataAction(c *cli.Context) error {
switch c.NArg() {
case 0:
switch {
diff --git a/cmd/fscrypt/errors.go b/cmd/fscrypt/errors.go
index 81a6798..288e697 100644
--- a/cmd/fscrypt/errors.go
+++ b/cmd/fscrypt/errors.go
@@ -45,7 +45,7 @@ const failureExitCode = 1
// Various errors used for the top level user interface
var (
ErrCanceled = errors.New("operation canceled")
- ErrNoDesctructiveOps = errors.New("operation would be destructive")
+ ErrNoDestructiveOps = errors.New("operation would be destructive")
ErrMaxPassphrase = util.SystemError("max passphrase length exceeded")
ErrInvalidSource = errors.New("invalid source type")
ErrPassphraseMismatch = errors.New("entered passphrases do not match")
@@ -116,7 +116,7 @@ func getErrorSuggestions(err error) string {
metadata is corrupted.`
case actions.ErrMissingProtectorName:
return fmt.Sprintf("Use %s to specify a protector name.", shortDisplay(nameFlag))
- case ErrNoDesctructiveOps:
+ case ErrNoDestructiveOps:
return fmt.Sprintf("Use %s to automatically run destructive operations.", shortDisplay(forceFlag))
case ErrSpecifyProtector:
return fmt.Sprintf("Use %s to specify a protector.", shortDisplay(protectorFlag))
@@ -165,8 +165,8 @@ func newExitError(c *cli.Context, err error) error {
return cli.NewExitError(message, failureExitCode)
}
-// usageError implements cli.ExitCoder to will print the usage and the return a
-// non-zero value. This error should be used when a command is used incorrectly.
+// usageError implements cli.ExitCoder to print the usage and return a non-zero
+// value. This error should be used when a command is used incorrectly.
type usageError struct {
c *cli.Context
message string
diff --git a/cmd/fscrypt/format.go b/cmd/fscrypt/format.go
index ef009d3..c2a4fce 100644
--- a/cmd/fscrypt/format.go
+++ b/cmd/fscrypt/format.go
@@ -74,7 +74,7 @@ func init() {
}
-// Flags that conform to this interface can be used with an urfave/cli
+// Flags that conform to this interface can be used with a urfave/cli
// application and can be printed in the correct format.
type prettyFlag interface {
cli.Flag
@@ -111,8 +111,8 @@ func longDisplay(f prettyFlag, defaultString ...string) string {
usage += fmt.Sprintf(" (default: %v)", defaultString[0])
}
- // We pad the the shortDisplay on the right with enough spaces to equal
- // the longest flag's display
+ // We pad the shortDisplay on the right with enough spaces to equal the
+ // longest flag's display
shortDisp := shortDisplay(f)
length := utf8.RuneCountInString(shortDisp)
shortDisp += strings.Repeat(" ", maxShortDisplay-length)
diff --git a/cmd/fscrypt/fscrypt.go b/cmd/fscrypt/fscrypt.go
index f35d6f6..9ac8e2f 100644
--- a/cmd/fscrypt/fscrypt.go
+++ b/cmd/fscrypt/fscrypt.go
@@ -85,7 +85,7 @@ func main() {
}
// setupCommand performs some common setup for each command. This includes
-// hiding the help, formating the description, adding in the necessary
+// hiding the help, formatting the description, adding in the necessary
// flags, setting up error handlers, etc... Note that the command is modified
// in place and its subcommands are also setup.
func setupCommand(command *cli.Command) {
@@ -102,7 +102,7 @@ func setupCommand(command *cli.Command) {
if len(command.Subcommands) == 0 {
command.Before = setupBefore
} else {
- // Cleanup subcommands (if applicable)
+ // Setup subcommands (if applicable)
for i := range command.Subcommands {
setupCommand(&command.Subcommands[i])
}
@@ -112,8 +112,6 @@ func setupCommand(command *cli.Command) {
// setupBefore makes sure our logs, errors, and output are going to the correct
// io.Writers and that we haven't over-specified our flags. We only print the
// logs when using verbose, and only print normal stuff when not using quiet.
-// When running with sudo, this function also verifies that we have the proper
-// keyring linkage enabled.
func setupBefore(c *cli.Context) error {
log.SetOutput(ioutil.Discard)
c.App.Writer = ioutil.Discard
diff --git a/cmd/fscrypt/prompt.go b/cmd/fscrypt/prompt.go
index 0031e8f..5fce0c7 100644
--- a/cmd/fscrypt/prompt.go
+++ b/cmd/fscrypt/prompt.go
@@ -90,7 +90,7 @@ func askConfirmation(question string, defaultChoice bool, warning string) error
// Defaults of "no" require forcing.
if !defaultChoice {
if quietFlag.Value {
- return ErrNoDesctructiveOps
+ return ErrNoDestructiveOps
}
}
diff --git a/cmd/fscrypt/protector.go b/cmd/fscrypt/protector.go
index 32ba4ab..8cbcf03 100644
--- a/cmd/fscrypt/protector.go
+++ b/cmd/fscrypt/protector.go
@@ -56,7 +56,7 @@ func createProtectorFromContext(ctx *actions.Context) (*actions.Protector, error
}
// selectExistingProtector returns a locked Protector which corresponds to an
-// options in the non-empty slice of options. Prompts for user input are used to
+// option in the non-empty slice of options. Prompts for user input are used to
// get the keys and select the option.
func selectExistingProtector(ctx *actions.Context, options []*actions.ProtectorOption) (*actions.Protector, error) {
idx, err := promptForProtector(options)
diff --git a/cmd/fscrypt/setup.go b/cmd/fscrypt/setup.go
index 72dfbdb..f2fff96 100644
--- a/cmd/fscrypt/setup.go
+++ b/cmd/fscrypt/setup.go
@@ -1,5 +1,5 @@
/*
- * strings.go - File containing the functionality initializing directories and
+ * setup.go - File containing the functionality for initializing directories and
* the global config file.
*
* Copyright 2017 Google Inc.
diff --git a/cmd/fscrypt/status.go b/cmd/fscrypt/status.go
index 1465a4e..f911193 100644
--- a/cmd/fscrypt/status.go
+++ b/cmd/fscrypt/status.go
@@ -65,7 +65,7 @@ func yesNoString(b bool) string {
return "No"
}
-// writeGlobalStatus prints all the filesystem that use (or could use) fscrypt.
+// writeGlobalStatus prints all the filesystems that use (or could use) fscrypt.
func writeGlobalStatus(w io.Writer) error {
mounts, err := filesystem.AllFilesystems()
if err != nil {
diff --git a/cmd/fscrypt/strings.go b/cmd/fscrypt/strings.go
index c680d03..adef81d 100644
--- a/cmd/fscrypt/strings.go
+++ b/cmd/fscrypt/strings.go
@@ -130,7 +130,7 @@ var plurals = map[string]string{
"policy": "policies",
}
-// pluralize prints our the correct pluralization of a work along with the
+// pluralize prints out the correct pluralization of a word along with the
// specified count. This means pluralize(1, "policy") = "1 policy" but
// pluralize(2, "policy") = "2 policies"
func pluralize(count int, word string) string {