C
C#10mo ago
Mekasu0124

✅ creating a CLI application

I don’t know if these are similar to console apps or not but I want to create a CLI program that is tailored for me I just don’t know how or where to start. Ideas?
13 Replies
Angius
Angius10mo ago
dotnet new console
Mekasu0124
Mekasu0124OP10mo ago
And that’s going to start me on a project that will allow me to open up a command prompt and type something like myapp create <project_name> <destination_dir> ? Like a pip installation type ordeal. That’s what I’m wanting to make
Angius
Angius10mo ago
Yes
Console.WriteLine($"So, you want a {args[0]}, huh?");
Console.WriteLine($"So, you want a {args[0]}, huh?");
Compile it to myapp.exe
$ myapp.exe pudding
So, you want a pugging, huh?
$ myapp.exe pudding
So, you want a pugging, huh?
There are libraries that make it easier, too Spectre.Console.Cli for example
Mekasu0124
Mekasu0124OP10mo ago
Ok so magic question. I get it all built. It’s working wonderfully. How do I make it “online” like pip?
Angius
Angius10mo ago
What do you mean by "online"? How do you upload your app somewhere where other people can download it from? How do you host the packages your app can download?
Mekasu0124
Mekasu0124OP10mo ago
My fault. Very vague questions lol 1. How do I shorten it from myapp.exe to just myapp 2. How do I, or where do i, upload the app (or self host) so that I can use it? And also, long time no chat lol how you need ZZZZ?
Angius
Angius10mo ago
1. Usually, by adding it to the $PATH environment variable 2. Github releases, should your project be open-source and also on Github. Otherwise, any random blob storage and your own website. Also, registries like Winget, Chocolatey, Scoop, etc
Naarfy
Naarfy10mo ago
Any user will need to download the app, do you mean you want to stream the output of your console to a website ?
Mekasu0124
Mekasu0124OP10mo ago
No. The purpose of the app is I’m tired of manually creating projects and workspaces so I’m starting it off tailored more for me, but I plan to grow it. It’s going to start off supporting Python, JS, and C# projects. The project also asks for your top level directory for your projects so if you have a folder called programming and you build all of your projects in that folder , then that’s your top level directory. You’d give it the full path C:\…myTopLevelDir Example: I want to start building a new discord bot in Python using the disnake framework. I’ll type in console myapp create python bot disnake. Where create is the function, Python is the language, bot is the type of program (other options are desktop, web, and mobile) and disnake is the library. It’ll then create the project directory in the destination you have it during setup and then itll create some start files for you. Main.py with a bot class. A Commands, Events, and Tasks folder with a file in each of an example item for each file and so on for the entire project So I’ll need to add an option during setup for adding the program to path I can create my program and then put it on pip? Or dotnet actually
Angius
Angius10mo ago
Pip is a Python package manager Yes, you can release it on Nuget as a tool
Mekasu0124
Mekasu0124OP10mo ago
Oh ok cool
Angius
Angius10mo ago
Then it can be installed with dotnet tool install MekasuSuperTool And ran with dotnet MekasuSuperTool
Mekasu0124
Mekasu0124OP10mo ago
Ok awesome. I have a lot to do then 🥰🥰
Want results from more Discord servers?
Add your server