git-plus icon indicating copy to clipboard operation
git-plus copied to clipboard

[REQUEST] File mode

Open ashthespy opened this issue 7 years ago • 1 comments

With proliferation of docker and Windows Subsystem for Linux, I have found quite often that I require to add shell scripts from my windows box.

Would it be possible to pass in the --chmod=+x flag to git add either via a separate option or a user configurable option to do it automatically?

PS: If you'd like I could take a shot at it and submit a PR.

ashthespy avatar Mar 10 '18 15:03 ashthespy

You could setup custom commands for this.

I'm not sure if you prefer vanilla js or coffeescript but here's an init.js snippet that should work

atom.packages.onDidActivateInitialPackages(() => {
  const gitPlus = atom.packages.getActivePackage("git-plus")
  if (gitPlus) {
    const gp = gitPlus.mainModule.provideService()
    gp.registerCommand(
      "atom-text-editor",
      "your-custom-namespace:add-chmod", // feel free to change this
      () => {
        gp
          .getRepo() // If there are multiple repos in the project, you will be prompted to select which to use
          .then(repo => {
            const activeEditor = atom.workspace.getActiveTextEditor()
            if (activeEditor)
              gitPlus.run(repo, `add --chmod=+x ${activeEditor.getPath()}`)
          })
      }
    )
  }
})

You could also add a second command for add all that uses * instead of a particular file path as well.

akonwi avatar Jul 04 '18 05:07 akonwi