israelroldan / grunt-ssh

SSH, SFTP tasks for Grunt.
https://npmjs.org/package/grunt-ssh
MIT License
244 stars 70 forks source link

Access the current config from the command #100

Closed xescugc closed 9 years ago

xescugc commented 9 years ago

I wonder if there is a way i can inject the attributes of the current config to use them in the command:

grunt.initConfig({
  sshconfig: {
    staging: {
      host: "my.staging.server",
      username: "user",
      password: "password",
      pathToCurrent: "/path/to/staging/current"
    },
    production: {
      host: "my.production.server",
      username: "user",
      password: "password",
      pathToCurrent: "/path/to/production/current"
    }
  },
  sshexec: {
    ls: {
      command: 'cd <%= config.pathToCurrent %>'
    }  
  }
}

This way if I run $> grunt sshexec:ls --config staging will be different from $> grunt sshexec:ls --config production. This is useful if you have some similar commands that only differ from the path and not the action. If it's not possible, which is the work around?

xescugc commented 9 years ago

Sorry for that question, it can be solved using grunt.option('config'), with this i have the information i need, sorry :disappointed: