Initial commit
This commit is contained in:
commit
23a31f53cb
8
CMakeLists.txt
Normal file
8
CMakeLists.txt
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
cmake_minimum_required(VERSION 3.30)
|
||||||
|
project(breeze C)
|
||||||
|
|
||||||
|
set(CMAKE_C_STANDARD 23)
|
||||||
|
|
||||||
|
add_executable(breeze main.c
|
||||||
|
func.c
|
||||||
|
func.h)
|
||||||
20
LICENSE
Normal file
20
LICENSE
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
MIT License
|
||||||
|
Copyright (c) 2025 Nanokloon
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
13
README.MD
Normal file
13
README.MD
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
# Breeze, a fun side-project for a BSc EE student.
|
||||||
|
## Are you tired of typing the same old command 100 times?
|
||||||
|
### Can you not be asked to alias commands?
|
||||||
|
#### Well then breeze has a solution for you!
|
||||||
|
# **Breeze: Custom Shortcut CLI for Frequent Commands**
|
||||||
|
|
||||||
|
A lightweight utility that lets you define and manage aliases for commonly used shell commands with a simple interface.
|
||||||
|
|
||||||
|
TODO:
|
||||||
|
- [ ] decide on how to save the files in config files.
|
||||||
|
- to be expanded!
|
||||||
|
|
||||||
|
|
||||||
24
func.c
Normal file
24
func.c
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
//
|
||||||
|
// Created by nano on 4/1/25.
|
||||||
|
//
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
|
||||||
|
int whichOption(char *defaultOptions[],char *choice) {
|
||||||
|
int res =0;
|
||||||
|
//TODO: find a way to not have to hardcode the number of choices
|
||||||
|
for (int i=0;i<5;i++) {
|
||||||
|
|
||||||
|
if (strncmp(defaultOptions[i],choice,strlen(choice))==0) {
|
||||||
|
res = i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
void printHelp(){
|
||||||
|
printf("Usage: breeze <command> <arguments>\n");
|
||||||
|
printf("breeze is a cli tool that helps you create shortcuts for often repeated commands.\n");
|
||||||
|
printf("You can create local or global commands. Global commands are created with the breeze global <command> subset of commands \n");
|
||||||
|
}
|
||||||
9
func.h
Normal file
9
func.h
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
//
|
||||||
|
// Created by nano on 4/1/25.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef FUNC_H
|
||||||
|
#define FUNC_H
|
||||||
|
int whichOption(char *defaultOptions[],char *choice);
|
||||||
|
void printHelp();
|
||||||
|
#endif //FUNC_H
|
||||||
49
main.c
Normal file
49
main.c
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include "func.h"
|
||||||
|
|
||||||
|
|
||||||
|
char *defaultOptions[]={"help","add","run","del","rm"};
|
||||||
|
|
||||||
|
void addCmd(char ** str);
|
||||||
|
void delCmd(char ** str);
|
||||||
|
void runCmd(char ** str);
|
||||||
|
|
||||||
|
int main(int argc, char *argv[]) {
|
||||||
|
//printf("%d \n", argc);
|
||||||
|
if (argc<2) {
|
||||||
|
printHelp();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
int choice = whichOption(defaultOptions,argv[1]);
|
||||||
|
printf(argv[1]);
|
||||||
|
printf("choice is %d \n",choice);
|
||||||
|
|
||||||
|
switch (choice) {
|
||||||
|
case 1: // add
|
||||||
|
addCmd(&argv[2]);
|
||||||
|
case 2: // run
|
||||||
|
runCmd(&argv[2]);
|
||||||
|
case 3:
|
||||||
|
case 4:
|
||||||
|
delCmd(argv[2]);
|
||||||
|
default:
|
||||||
|
printf("not yet implemented\\invalid");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void addCmd(char ** str) { //TODO: implement
|
||||||
|
printf("adding %s \n", *str);
|
||||||
|
}
|
||||||
|
void delCmd(char ** str) { //TODO: implement
|
||||||
|
printf("removed %s \n", *str);
|
||||||
|
}
|
||||||
|
void runCmd(char ** str) { //TODO: implement
|
||||||
|
printf("running %s \n", *str);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user