forked from wakatime/visualstudio-wakatime
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPythonCliParameters.cs
45 lines (40 loc) · 1.22 KB
/
PythonCliParameters.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
using System.Collections.ObjectModel;
using System.IO;
using System.Linq;
namespace WakaTime
{
internal class PythonCliParameters
{
public string Cli
{
get { return Path.Combine(WakaTimeConstants.UserConfigDir, WakaTimeConstants.CliFolder); }
}
public string Key { get; set; }
public string File { get; set; }
public string Plugin { get; set; }
public bool IsWrite { get; set; }
public string Project { get; set; }
public string[] ToArray(bool obfuscate = false)
{
var parameters = new Collection<string>
{
Cli,
"--key",
obfuscate ? string.Format("********-****-****-****-********{0}", Key.Substring(Key.Length - 4)) : Key,
"--file",
File,
"--plugin",
Plugin
};
if (IsWrite)
parameters.Add("--write");
// ReSharper disable once InvertIf
if (!string.IsNullOrEmpty(Project))
{
parameters.Add("--project");
parameters.Add(Project);
}
return parameters.ToArray();
}
}
}