Move hard out of flag args and into command
This commit is contained in:
@@ -13,6 +13,7 @@ type LinkInstruction struct {
|
||||
Source string
|
||||
Target string
|
||||
Force bool
|
||||
Hard bool
|
||||
}
|
||||
|
||||
func (instruction *LinkInstruction) String() string {
|
||||
@@ -35,6 +36,10 @@ func ParseInstruction(line string) (LinkInstruction, error) {
|
||||
res, _ := regexp.MatchString(`^(?i)\s*T|TRUE\s*$`, parts[2])
|
||||
instruction.Force = res
|
||||
}
|
||||
if len(parts) > 3 {
|
||||
res, _ := regexp.MatchString(`^(?i)\s*T|TRUE\s*$`, parts[3])
|
||||
instruction.Hard = res
|
||||
}
|
||||
|
||||
instruction.Source, _ = ConvertHome(instruction.Source)
|
||||
instruction.Target, _ = ConvertHome(instruction.Target)
|
||||
@@ -123,7 +128,7 @@ func (instruction *LinkInstruction) RunAsync(status chan (error)) {
|
||||
}
|
||||
|
||||
var err error
|
||||
if *hard {
|
||||
if instruction.Hard {
|
||||
err = os.Link(instruction.Source, instruction.Target)
|
||||
} else {
|
||||
err = os.Symlink(instruction.Source, instruction.Target)
|
||||
|
Reference in New Issue
Block a user