Skip to content

Commit

Permalink
improve readabillity
Browse files Browse the repository at this point in the history
  • Loading branch information
elasticroentgen committed Sep 9, 2024
1 parent 4a359d6 commit f96058e
Showing 1 changed file with 11 additions and 14 deletions.
25 changes: 11 additions & 14 deletions sherlog-cli/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,20 +53,18 @@ class Program

private static string ReadFileIgnoringComments(string filePath)
{
StringBuilder contentBuilder = new StringBuilder();
StringBuilder contentBuilder = new();
try
{
using (StreamReader reader = new StreamReader(filePath))
using StreamReader reader = new(filePath);
string line;
while ((line = reader.ReadLine()) != null)

Check warning on line 61 in sherlog-cli/Program.cs

View workflow job for this annotation

GitHub Actions / build

Converting null literal or possible null value to non-nullable type.

Check warning on line 61 in sherlog-cli/Program.cs

View workflow job for this annotation

GitHub Actions / build

Converting null literal or possible null value to non-nullable type.

Check warning on line 61 in sherlog-cli/Program.cs

View workflow job for this annotation

GitHub Actions / build

Converting null literal or possible null value to non-nullable type.

Check warning on line 61 in sherlog-cli/Program.cs

View workflow job for this annotation

GitHub Actions / build

Converting null literal or possible null value to non-nullable type.
{
string line;
while ((line = reader.ReadLine()) != null)
// Check if the line starts with '#'
if (!line.TrimStart().StartsWith("#"))
{
// Check if the line starts with '#'
if (!line.TrimStart().StartsWith("#"))
{
// Process the line as it does not start with '#'
contentBuilder.AppendLine(line);
}
// Process the line as it does not start with '#'
contentBuilder.AppendLine(line);
}
}
}
Expand All @@ -81,16 +79,15 @@ private static string ReadFileIgnoringComments(string filePath)
static async Task<int> Main(string[] args)
{
string sherlogServer = Environment.GetEnvironmentVariable("SHERLOG_SERVER") ?? "http://localhost:5062";
Console.WriteLine("==[ Sherlog CLI ]==");
Console.WriteLine($"Sherlog Server: {sherlogServer}");
Console.WriteLine("\n\n======[ Sherlog CLI ]======\n");

// look for sherlog config
string tenant;
string project;
string? sherlogPath = FindSherlogFile();

// Query for tenants
HttpClient hc = new HttpClient();
HttpClient hc = new();
hc.BaseAddress = new Uri(sherlogServer);

List<string> tenants = [];
Expand Down Expand Up @@ -168,7 +165,7 @@ static async Task<int> Main(string[] args)
try
{
// Start the editor with the temporary file
Process editorProcess = new Process
Process editorProcess = new()
{
StartInfo = new ProcessStartInfo
{
Expand Down

0 comments on commit f96058e

Please sign in to comment.