Skip to content
This repository was archived by the owner on Feb 26, 2023. It is now read-only.

Added support for pre and post commands#13

Merged
FooSoft merged 2 commits intomasterfrom
unknown repository
Jan 5, 2017
Merged

Added support for pre and post commands#13
FooSoft merged 2 commits intomasterfrom
unknown repository

Conversation

@ghost
Copy link

@ghost ghost commented Jan 4, 2017

Two new fields were added to the config. Precmds runs before cmds and
links. Postcmds runs after cmds and links. Cmds is no longer necessary
but was left in for compatibility.

Two new fields were added to the config. Precmds runs before cmds and
links. Postcmds runs after cmds and links. Cmds is no longer necessary
but was left in for compatibility.
@ghost
Copy link
Author

ghost commented Jan 4, 2017

This is useful for a variety of programs.

As an example one might use xmonad. First one must install xmonad, then link ones configuration, then after it has been installed one must xmonad --recompile to use the config.

task.go Outdated
Rejects [][]string
Deps []string
Links [][]string
Precmds [][]string
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use tabs, not spaces for indentation, rename Precmds to CmdsPre and Postcmds to CmdsPost to conform with naming convention.

task.go Outdated
}
}

if conf.flags&flagNoCmds == 0 {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Combine the if check with the one directly below it, no need to perform the same test twice.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also again, tabs not spaces

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should just be able to run gofmt on the source file.

@FooSoft
Copy link
Owner

FooSoft commented Jan 4, 2017

Please fix the issues I pointed out, retab the source file. It would be nice if you also updated the documentation to reflect these new features (mention them in the paragraph below):

In addition to creating links, Homemaker is capable of executing commands on a per-task basis. Commands should be defined in an array called cmds, split into an item per each command line argument. All of the commands are executed with dest as the working directory (as mentioned previously, this defaults to your home directory). If any command returns a nonzero exit code, Homemaker will display an error message and prompt the user to determine if it should abort, retry, or cancel.

This commit switches indentation to tabs, rather than spaces, removes an
unnecessary conditional check and adopts the project naming convention.
It also updates the documentation to reflect the changes it creates.
@ghost
Copy link
Author

ghost commented Jan 5, 2017

I fixed the issues you mentioned. I also edited the docs, althought I feel I might have changed the style of the entry. If you feel that is the case I will try to rewrite them in a style more consistent with the rest of the documentation.

@FooSoft FooSoft merged commit fc6740c into FooSoft:master Jan 5, 2017
@FooSoft
Copy link
Owner

FooSoft commented Jan 5, 2017

It was close enough, so I merged it in and added some small tweaks. Thanks for the code.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant