Skip to content

Commit

Permalink
chore: Join some long lines
Browse files Browse the repository at this point in the history
  • Loading branch information
twpayne committed Jan 12, 2024
1 parent 404878c commit d48d5a5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 14 deletions.
12 changes: 3 additions & 9 deletions internal/chezmoi/sourcestate.go
Original file line number Diff line number Diff line change
Expand Up @@ -965,9 +965,7 @@ func (s *SourceState) Read(ctx context.Context, options *ReadOptions) error {
return nil
case fileInfo.IsDir():
da := parseDirAttr(sourceName.String())
targetRelPath := parentSourceRelPath.Dir().
TargetRelPath(s.encryption.EncryptedSuffix()).
JoinString(da.TargetName)
targetRelPath := parentSourceRelPath.Dir().TargetRelPath(s.encryption.EncryptedSuffix()).JoinString(da.TargetName)
if s.Ignore(targetRelPath) {
return fs.SkipDir
}
Expand All @@ -993,9 +991,7 @@ func (s *SourceState) Read(ctx context.Context, options *ReadOptions) error {
return nil
case fileInfo.Mode().IsRegular():
fa := parseFileAttr(sourceName.String(), s.encryption.EncryptedSuffix())
targetRelPath := parentSourceRelPath.Dir().
TargetRelPath(s.encryption.EncryptedSuffix()).
JoinString(fa.TargetName)
targetRelPath := parentSourceRelPath.Dir().TargetRelPath(s.encryption.EncryptedSuffix()).JoinString(fa.TargetName)
if s.Ignore(targetRelPath) {
return nil
}
Expand Down Expand Up @@ -2677,9 +2673,7 @@ func (s *SourceState) readScriptsDir(ctx context.Context, scriptsDirAbsPath AbsP
if fa.Type != SourceFileTypeScript {
return fmt.Errorf("%s: not a script", sourceAbsPath)
}
targetRelPath := parentSourceRelPath.Dir().
TargetRelPath(s.encryption.EncryptedSuffix()).
JoinString(fa.TargetName)
targetRelPath := parentSourceRelPath.Dir().TargetRelPath(s.encryption.EncryptedSuffix()).JoinString(fa.TargetName)
if s.Ignore(targetRelPath) {
return nil
}
Expand Down
7 changes: 2 additions & 5 deletions internal/cmd/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -746,8 +746,7 @@ func (c *Config) createAndReloadConfigFile(cmd *cobra.Command) error {
// Write the config.
configPath := c.init.configPath
if c.init.configPath.Empty() {
configPath = chezmoi.NewAbsPath(c.bds.ConfigHome).
Join(chezmoiRelPath, configTemplate.targetRelPath)
configPath = chezmoi.NewAbsPath(c.bds.ConfigHome).Join(chezmoiRelPath, configTemplate.targetRelPath)
}
if err := chezmoi.MkdirAll(c.baseSystem, configPath.Dir(), fs.ModePerm); err != nil {
return err
Expand Down Expand Up @@ -1456,9 +1455,7 @@ func (c *Config) gitCommitMessage(cmd *cobra.Command, status *git.Status) ([]byt
"promptInt": c.promptIntInteractiveTemplateFunc,
"promptString": c.promptStringInteractiveTemplateFunc,
"targetRelPath": func(source string) string {
return chezmoi.NewSourceRelPath(source).
TargetRelPath(c.encryption.EncryptedSuffix()).
String()
return chezmoi.NewSourceRelPath(source).TargetRelPath(c.encryption.EncryptedSuffix()).String()
},
})
var name string
Expand Down

0 comments on commit d48d5a5

Please sign in to comment.