Skip to content

Commit 2fed2cb

Browse files
committed
Adds Verbose output option.
In case teams want to know whats actually getting run and deploying.
1 parent 4372452 commit 2fed2cb

File tree

4 files changed

+24
-2
lines changed

4 files changed

+24
-2
lines changed

FRC-Extension/FRC-ExtensionPackage.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public Frc_ExtensionPackage()
6060
private OutputWriter m_writer;
6161
private MonoFile m_monoFile;
6262

63-
63+
public static Frc_ExtensionPackage Instance { get; private set; }
6464

6565
internal object PublicGetService(Type serviceType)
6666
{
@@ -96,6 +96,7 @@ internal DialogPage PublicGetDialogPage(Type dialogPageType)
9696
/// </summary>
9797
protected override void Initialize()
9898
{
99+
Instance = this;
99100
Debug.WriteLine (string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of: {0}", this.ToString()));
100101
base.Initialize();
101102

FRC-Extension/RoboRIOCode/DeployProperties.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public static class DeployProperties
1313
public const string DeployDir = "/home/lvuser/mono";
1414
public static readonly string[] DeployKillCommand =
1515
{
16-
". /etc/profile.d/natinst-path.sh; /usr/local/frc/bin/frcKillRobot.sh -t -r",
16+
". /etc/profile.d/natinst-path.sh; /usr/local/frc/bin/frcKillRobot.sh -t -r;",
1717
};
1818

1919
public const string KillOnlyCommand = "/usr/local/frc/bin/frcKillRobot.sh";

FRC-Extension/RoboRIOCode/RoboRIOConnection.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,14 @@ public static async Task<Dictionary<string, SshCommand>> RunCommands(string[] co
171171
{
172172
return null;
173173
}
174+
var settings = (SettingsPageGrid)Frc_ExtensionPackage.Instance.PublicGetDialogPage(typeof(SettingsPageGrid));
175+
bool verbose = settings.Verbose;
174176
foreach (string s in commands)
175177
{
178+
if (verbose)
179+
{
180+
OutputWriter.Instance.WriteLine($"Running command: {s}");
181+
}
176182
await Task.Run(() =>
177183
{
178184
var x = ssh.RunCommand(s);
@@ -209,6 +215,12 @@ public static async Task<SshCommand> RunCommand(string command, ConnectionUser u
209215
{
210216
return null;
211217
}
218+
var settings = (SettingsPageGrid)Frc_ExtensionPackage.Instance.PublicGetDialogPage(typeof(SettingsPageGrid));
219+
bool verbose = settings.Verbose;
220+
if (verbose)
221+
{
222+
OutputWriter.Instance.WriteLine($"Running command: {command}");
223+
}
212224
return await Task.Run(() => ssh.RunCommand(command));
213225
}
214226
}
@@ -239,8 +251,14 @@ public static async Task<bool> DeployFiles(IEnumerable files, string deployLocat
239251
{
240252
return false;
241253
}
254+
var settings = (SettingsPageGrid)Frc_ExtensionPackage.Instance.PublicGetDialogPage(typeof(SettingsPageGrid));
255+
bool verbose = settings.Verbose;
242256
foreach (FileInfo fileInfo in from string s in files where File.Exists(s) select new FileInfo(s))
243257
{
258+
if (verbose)
259+
{
260+
OutputWriter.Instance.WriteLine($"Deploying File: {fileInfo.Name.ToString()}");
261+
}
244262
await Task.Run(() => scp.Upload(fileInfo, deployLocation));
245263
}
246264
}

FRC-Extension/Settings.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,8 @@ public class SettingsPageGrid : DialogPage
2121

2222
[Category("Team Options"), DisplayName("Auto Start Netconsole?"), Description("Auto start the netconsole viewer when running code?")]
2323
public bool Netconsole { get; set; }
24+
25+
[Category("Extension Options"), DisplayName("Enable Verbose Output?"), Description("Enables verbose output during the deploy process?")]
26+
public bool Verbose { get; set; }
2427
}
2528
}

0 commit comments

Comments
 (0)