Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Help tweaks #166

Merged
merged 3 commits into from
Jan 25, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Always print permissions with three digits
  • Loading branch information
twpayne committed Jan 24, 2019
commit 6a1a0ea08ac48fc900a8be8862b73e7b0d9203f3
2 changes: 1 addition & 1 deletion cmd/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ type Config struct {
configFile string
SourceDir string
DestDir string
Umask octalIntValue
Umask permValue
DryRun bool
Verbose bool
SourceVCSCommand string
Expand Down
21 changes: 0 additions & 21 deletions cmd/octal_int_value.go

This file was deleted.

24 changes: 24 additions & 0 deletions cmd/perm_value.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package cmd

import (
"fmt"
"strconv"
)

// An permValue is an int that is printed in octal. It implements the
// pflag.Value interface for use as a command line flag.
type permValue int

func (p *permValue) Set(s string) error {
v, err := strconv.ParseInt(s, 0, 64)
*p = permValue(v)
return err
}

func (p *permValue) String() string {
return fmt.Sprintf("%03o", *p)
}

func (p *permValue) Type() string {
return "int"
}
2 changes: 1 addition & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (

var (
config = Config{
Umask: octalIntValue(getUmask()),
Umask: permValue(getUmask()),
SourceVCSCommand: "git",
}
version = "dev"
Expand Down