Skip to content
This repository has been archived by the owner on Feb 6, 2022. It is now read-only.

Commit

Permalink
Merge pull request #8 from Arch2x/new-ver
Browse files Browse the repository at this point in the history
Make for v0.0.3
  • Loading branch information
alphaX86 authored Dec 29, 2020
2 parents f7d539a + 1a73871 commit 5188eb4
Show file tree
Hide file tree
Showing 9 changed files with 112 additions and 15 deletions.
Binary file added Demo.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,14 @@ Note: C++ template is only added for now
- Wait for sometime until the script finishes installing necessary packages
- Then, voila! Type `codeit` to start!

![Demo](https://raw.githubusercontent.com/alphaX86/codeit/master/code1.png)
![Demo](https://raw.githubusercontent.com/alphaX86/codeit/master/code.gif)

## Demo
Here's a demo of the project to understand! (Done using VS Code)

![Demo1](https://raw.githubusercontent.com/alphaX86/codeit/master/Demo.gif)


## Contributions
Any type of contributions are welcome to this repo! Refer [Contributions](./CONTRIBUTING.md) for more details.

Expand Down
Binary file added code.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed code1.png
Binary file not shown.
12 changes: 10 additions & 2 deletions codeit/codeit.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import os
from clint.textui import colored
from codeit.codeitHelp import help
from codeit.codeitInit import init, init_noerror
from codeit.codeitInit import init, init_noerror, init_noerror_agg
from codeit.codeitMeta import template_cp, get_filename, get_fn_beginner

def main():
Expand All @@ -28,6 +28,10 @@ def main():
contestName = sys.argv[countArg+2]
fileNames = get_fn_beginner()
init_noerror(contestName, fileNames)
elif sys.argv[countArg+1] == '-t2':
contestName = sys.argv[countArg+2]
fileNames = get_fn_beginner()
init_noerror_agg(contestName, fileNames)
else:
contestName = sys.argv[countArg+1]
fileNames = get_fn_beginner()
Expand All @@ -36,13 +40,17 @@ def main():
contestName = sys.argv[countArg+1]
fileNames = get_filename()
init_noerror(contestName, fileNames)
elif sys.argv[countArg] == '-t2':
contestName = sys.argv[countArg+1]
fileNames = get_filename()
init_noerror_agg(contestName, fileNames)
else:
contestName = sys.argv[countArg]
fileNames = get_filename()
init(contestName, fileNames)

elif arg == "-v":
print(colored.magenta('CODEIt v0.0.2 (c)2020, alphaX86'))
print(colored.magenta('CODEIt v0.0.3 (c)2020 - 2021, alphaX86 under Arch-1'))

elif arg == "-h":
help()
Expand Down
15 changes: 8 additions & 7 deletions codeit/codeitHelp.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@ def help():

print(colored.cyan("A CLI Script tool to help you initialize CPP files for any contest"))
print('\nCommands:\n')
print(colored.magenta("codeit <flags> <args>\n"))
print(colored.magenta("codeit <args> <filename/contestname>\n"))
print(colored.red('Args list\n'))
print(colored.yellow("-h \n" + colored.blue("To display help menu")))
print(colored.yellow("-i <contest> \n" + colored.blue("To initialize a contest directory")))
print(colored.yellow("-i -b <contest> \n" + colored.blue("To initialize a contest directory for practice and beginner level")))
print(colored.yellow("-i <args> -ne <contest> \n" + colored.blue("To initialize a contest directory without error.txt file")))
print(colored.yellow("-i -n <file> \n" + colored.blue("To initialize only a single file")))
print(colored.yellow("-v \n" + colored.blue("To print version number")))
print(colored.yellow("-h -------------------------- " + colored.blue("To display help menu")))
print(colored.yellow("-i <contest> ----------------" + colored.blue("To initialize a contest directory")))
print(colored.yellow("-i -b <contest> ------------- " + colored.blue("To initialize a contest directory for practice and beginner level")))
print(colored.yellow("-i <args> -ne <contest> ----- " + colored.blue("To initialize a contest directory without error.txt file")))
print(colored.yellow("-i <args> -t2 <contest> ----- " + colored.blue("To initialize a contest directory and use 2nd template without error.txt file")))
print(colored.yellow("-i -n <file> ---------------- " + colored.blue("To initialize only a single file")))
print(colored.yellow("-v -------------------------- " + colored.blue("To print version number")))
19 changes: 18 additions & 1 deletion codeit/codeitInit.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import os
from clint.textui import colored
from codeit.codeitMeta import template_cp
from codeit.codeitMeta import template_cp, template_agg

def write_to_file(filename, text, contestName=None):
full_filename = os.path.join(os.getcwd(), filename)
Expand Down Expand Up @@ -41,4 +41,21 @@ def init_noerror(contestName, fileNames):
# create input file
write_to_file('input.txt', '', contestName)
write_to_file('output.txt', '', contestName)
print(colored.green('Files have been created without error TXT file. Happy Coding!'))

# For template 2
def init_noerror_agg(contestName, fileNames):
try:
print(colored.blue('Making files and folders for ' + colored.magenta(contestName)))
os.makedirs(os.path.join(os.getcwd(), contestName))
except OSError:
print(colored.red("Failed! This directory cannot be created as it exists."))
else:
print(colored.yellow('Directory is made'))
# create files for contest (should be 6 cpp files)
for files in range(len(fileNames)):
write_to_file(fileNames[files], template_agg(), contestName)
# create input file
write_to_file('input.txt', '', contestName)
write_to_file('output.txt', '', contestName)
print(colored.green('Files have been created without error TXT file. Happy Coding!'))
67 changes: 66 additions & 1 deletion codeit/codeitMeta.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#Default template
def template_cp():
template = """#include <bits/stdc++.h>
Expand Down Expand Up @@ -29,4 +30,68 @@ def get_filename():

def get_fn_beginner():
fileNames = ['A.cpp','B.cpp','C.cpp']
return fileNames
return fileNames

# Template 2
def template_agg():
temp = """#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#include <complex>
#include <queue>
#include <set>
#include <unordered_set>
#include <list>
#include <chrono>
#include <random>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <stack>
#include <iomanip>
#include <fstream>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> p32;
typedef pair<ll,ll> p64;
typedef pair<double,double> pdd;
typedef vector<ll> v64;
typedef vector<int> v32;
typedef vector<vector<int> > vv32;
typedef vector<vector<ll> > vv64;
typedef vector<vector<p64> > vvp64;
typedef vector<p64> vp64;
typedef vector<p32> vp32;
ll MOD = 998244353;
double eps = 1e-12;
#define forn(i,e) for(ll i = 0; i < e; i++)
#define forsn(i,s,e) for(ll i = s; i < e; i++)
#define rforn(i,s) for(ll i = s; i >= 0; i--)
#define rforsn(i,s,e) for(ll i = s; i >= e; i--)
#define dbg(x) cout<<#x<<" = "<<x<<ln
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define INF 2e18
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((ll)(x).size())
int main()
{
fast_cin();
//Code
return 0;
}
"""
return temp
5 changes: 2 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@

setup(
name='codeit',
version='0.0.2',
version='0.0.3',
author='Aadhitya A',
description = 'A CLI tool to create CPP files',
long_description = README,
description = 'A CLI tool to create CPP files for any contest',
license = 'GPL-3.0',
packages=find_packages(),
install_requires=[
Expand Down

0 comments on commit 5188eb4

Please sign in to comment.