Enhancing Explore.CLI
Tags: dotnet, csharp, opensource, beginners
Published: 2023-11-24 19:00:03

Greetings, fellow developers! Today, I'm happy to share my recent adventure with the `Explore.Cli` project, a journey marked by tackling challenging features and collaborative problem-solving, ultimately leading to the exciting release of Explore.CLI version 0.4.0.

### Introduction to Explore.CLI
During Hacktoberfest 2023, I discovered [Explore.Cli](https://github.com/SmartBear-DevRel/explore-cli), an intriguing command-line tool that piqued my curiosity. This tool offers a range of functionalities designed to enhance user experience working with [SwaggerHub](https://swagger.io/tools/swaggerhub/), sparking my interest to dive deeper and contribute.

### Initial Steps and First Contributions
My first engagement with Explore.Cli involved fixing a bug in their `export` feature, a process I detailed in a blog post you can find [here](https://dev.to/yousefmajidi/hacking-away-in-week-3-of-hacktoberfest-o2m). This initial step marked the beginning of a deeper journey into the project's development.

As I familiarized myself with Explore.Cli, several open issues caught my attention. Despite initial hesitations, I revisited two particular issues, deciding to take on the challenge of resolving them.

### Issue #6: Enhancing Export Functionality
The first issue I tackled was [issue #6](https://github.com/SmartBear-DevRel/explore-cli/issues/6), aimed at adding the ability to specify both a path and a filename for exporting. This required the introduction of a new `Option` variable:

```c#
var exportPath = new Option<string>(
    name: "--export-path", 
    description: "The path for exporting files. It can be either a relative or absolute path")
    { IsRequired = false };
exportPath.AddAlias("-ep");
```

I also adjusted the `Handler` for the `exportSpacesCommand` to integrate this new option:

```C#
exportSpacesCommand.SetHandler(async (ec, ep, en, v) =>
    { await ExportSpaces(ec, ep, en, v); },
    exploreCookie,
    exportPath,
    exportName,
    verbose);
```

Subsequently, the `ExportSpaces` method was modified to include these new options, and the `README.md` was updated to reflect these changes, culminating in [pull request #13](https://github.com/SmartBear-DevRel/explore-cli/pull/13).

### Building Upon the Foundation: Issue #4
Next, I addressed [issue #4](https://github.com/SmartBear-DevRel/explore-cli/issues/4), which involved adding a feature for users to select specific spaces to export. Building on my previous work, I ensured compatibility and consistency by developing this feature on top of the initial issue branch, incorporating all commits from pull request #13 into [pull request #14](https://github.com/SmartBear-DevRel/explore-cli/pull/14).

### Refining and Resolving Challenges
Throughout this process, I encountered various challenges, including aligning my code with the project's coding style, handling additional scenarios, and implementing file system permissions checks. Feedback from the project author prompted significant refinements and improvements, including code refactoring and unit testing.

### Workflow and Platform-Specific Considerations
An interesting twist occurred when some of my tests failed on a workflow run. This issue arose due to the `GetInvalidFileNameChars()` and `GetInvalidFilePathChars()` methods behaving differently on Linux compared to Windows. Initially, I addressed this by creating a custom array for invalid characters, but I later realized that this was unnecessary, as the project was intended for Windows use. This was a valuable lesson in understanding project scope and platform-specific considerations.

### Release of Explore.Cli v0.4.0
Finally, after overcoming these challenges and learning from them, I'm excited to announce that [Explore.Cli v0.4.0](https://www.nuget.org/packages/Explore.Cli) is [officially out!](https://www.linkedin.com/posts/frank-kilcommins_explorecli-040-activity-7133859321150361601-r3Oi?utm_source=share&utm_medium=member_desktop). This release marks a significant milestone in my open-source journey.

### Reflecting on the Experience
This experience with Explore.Cli` has been both challenging and rewarding, reinforcing the collaborative and supportive nature of the open-source community. Each contribution, from code to conversations, has been a valuable part of my growth as a developer.

Stay tuned for more insights and developments, and as always, I encourage you to dive into the project, contribute, and share your expertise. Happy coding!