Skip to content

Commit

Permalink
Changed password parameters (#5)
Browse files Browse the repository at this point in the history
- removed `PasswordStdin`
- changed that `Password` is now obscured when printed to Output
  • Loading branch information
arodus committed Nov 7, 2018
1 parent d5320a6 commit edc8d42
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 53 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [vNext]

- Removed `EnablePasswordStdin` parameter which was without any function.
- Changed that password parameter is now obscured when printed to output.
## [0.2.1] / 2018-11-05
- Fixed seperator between argument names and values.
## [0.2.0] / 2018-08-05
Expand Down
3 changes: 3 additions & 0 deletions src/Nuke.Docker.Generator/DefinitionParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ private void AddProperties(DataClass settingsClass, CommandDefinition definition

private void AddProperty(DataClass settingsClass, ArgumentDefinition argument)
{
//Todo improve
if(argument.Name == "password-stdin") return;
var propertyName = argument.Name.ToPascalCase(separator: '-');
var enumerations = GetEnumerationTypes(argument);
var isEnumeration = enumerations.Any();
Expand Down Expand Up @@ -138,6 +140,7 @@ private void AddProperty(DataClass settingsClass, ArgumentDefinition argument)
property.Type = GetNukeType(argument);

if (property.Type == "bool") property.Format = $"--{argument.Name}";
if (property.Name == "Password") property.Secret = true;
settingsClass.Properties.Add(property);
}

Expand Down
47 changes: 1 addition & 46 deletions src/Nuke.Docker/Generated/Docker.Generated.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4385,8 +4385,6 @@ public partial class DockerLoginSettings : DockerSettings
public override string ToolPath => base.ToolPath ?? DockerTasks.DockerPath;
/// <summary><p>Password.</p></summary>
public virtual string Password { get; internal set; }
/// <summary><p>Take the password from stdin.</p></summary>
public virtual bool? PasswordStdin { get; internal set; }
/// <summary><p>Username.</p></summary>
public virtual string Username { get; internal set; }
/// <summary><p>[SERVER]</p></summary>
Expand All @@ -4395,8 +4393,7 @@ protected override Arguments ConfigureArguments(Arguments arguments)
{
arguments
.Add("login")
.Add("--password {value}", Password)
.Add("--password-stdin", PasswordStdin)
.Add("--password {value}", Password, secret: true)
.Add("--username {value}", Username)
.Add("{value}", Server)
.Add("{value}", GetCliSettings(), customValue: true);
Expand Down Expand Up @@ -27569,48 +27566,6 @@ public static DockerLoginSettings ResetPassword(this DockerLoginSettings toolSet
return toolSettings;
}
#endregion
#region PasswordStdin
/// <summary><p><em>Sets <see cref="DockerLoginSettings.PasswordStdin"/>.</em></p><p>Take the password from stdin.</p></summary>
[Pure]
public static DockerLoginSettings SetPasswordStdin(this DockerLoginSettings toolSettings, bool? passwordStdin)
{
toolSettings = toolSettings.NewInstance();
toolSettings.PasswordStdin = passwordStdin;
return toolSettings;
}
/// <summary><p><em>Resets <see cref="DockerLoginSettings.PasswordStdin"/>.</em></p><p>Take the password from stdin.</p></summary>
[Pure]
public static DockerLoginSettings ResetPasswordStdin(this DockerLoginSettings toolSettings)
{
toolSettings = toolSettings.NewInstance();
toolSettings.PasswordStdin = null;
return toolSettings;
}
/// <summary><p><em>Enables <see cref="DockerLoginSettings.PasswordStdin"/>.</em></p><p>Take the password from stdin.</p></summary>
[Pure]
public static DockerLoginSettings EnablePasswordStdin(this DockerLoginSettings toolSettings)
{
toolSettings = toolSettings.NewInstance();
toolSettings.PasswordStdin = true;
return toolSettings;
}
/// <summary><p><em>Disables <see cref="DockerLoginSettings.PasswordStdin"/>.</em></p><p>Take the password from stdin.</p></summary>
[Pure]
public static DockerLoginSettings DisablePasswordStdin(this DockerLoginSettings toolSettings)
{
toolSettings = toolSettings.NewInstance();
toolSettings.PasswordStdin = false;
return toolSettings;
}
/// <summary><p><em>Toggles <see cref="DockerLoginSettings.PasswordStdin"/>.</em></p><p>Take the password from stdin.</p></summary>
[Pure]
public static DockerLoginSettings TogglePasswordStdin(this DockerLoginSettings toolSettings)
{
toolSettings = toolSettings.NewInstance();
toolSettings.PasswordStdin = !toolSettings.PasswordStdin;
return toolSettings;
}
#endregion
#region Username
/// <summary><p><em>Sets <see cref="DockerLoginSettings.Username"/>.</em></p><p>Username.</p></summary>
[Pure]
Expand Down
7 changes: 1 addition & 6 deletions src/Nuke.Docker/specifications/Docker.json
Original file line number Diff line number Diff line change
Expand Up @@ -4245,14 +4245,9 @@
"name": "Password",
"type": "string",
"format": "--password {value}",
"secret": true,
"help": "Password."
},
{
"name": "PasswordStdin",
"type": "bool",
"format": "--password-stdin",
"help": "Take the password from stdin."
},
{
"name": "Username",
"type": "string",
Expand Down

0 comments on commit edc8d42

Please sign in to comment.