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

Commit 5188eb4

Browse files
authored
Merge pull request #8 from Arch2x/new-ver
Make for v0.0.3
2 parents f7d539a + 1a73871 commit 5188eb4

File tree

9 files changed

+112
-15
lines changed

9 files changed

+112
-15
lines changed

Demo.gif

5.15 MB
Loading

README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,14 @@ Note: C++ template is only added for now
2323
- Wait for sometime until the script finishes installing necessary packages
2424
- Then, voila! Type `codeit` to start!
2525

26-
![Demo](https://raw.githubusercontent.com/alphaX86/codeit/master/code1.png)
26+
![Demo](https://raw.githubusercontent.com/alphaX86/codeit/master/code.gif)
27+
28+
## Demo
29+
Here's a demo of the project to understand! (Done using VS Code)
30+
31+
![Demo1](https://raw.githubusercontent.com/alphaX86/codeit/master/Demo.gif)
32+
33+
2734
## Contributions
2835
Any type of contributions are welcome to this repo! Refer [Contributions](./CONTRIBUTING.md) for more details.
2936

code.gif

2.56 MB
Loading

code1.png

-46.2 KB
Binary file not shown.

codeit/codeit.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import os
44
from clint.textui import colored
55
from codeit.codeitHelp import help
6-
from codeit.codeitInit import init, init_noerror
6+
from codeit.codeitInit import init, init_noerror, init_noerror_agg
77
from codeit.codeitMeta import template_cp, get_filename, get_fn_beginner
88

99
def main():
@@ -28,6 +28,10 @@ def main():
2828
contestName = sys.argv[countArg+2]
2929
fileNames = get_fn_beginner()
3030
init_noerror(contestName, fileNames)
31+
elif sys.argv[countArg+1] == '-t2':
32+
contestName = sys.argv[countArg+2]
33+
fileNames = get_fn_beginner()
34+
init_noerror_agg(contestName, fileNames)
3135
else:
3236
contestName = sys.argv[countArg+1]
3337
fileNames = get_fn_beginner()
@@ -36,13 +40,17 @@ def main():
3640
contestName = sys.argv[countArg+1]
3741
fileNames = get_filename()
3842
init_noerror(contestName, fileNames)
43+
elif sys.argv[countArg] == '-t2':
44+
contestName = sys.argv[countArg+1]
45+
fileNames = get_filename()
46+
init_noerror_agg(contestName, fileNames)
3947
else:
4048
contestName = sys.argv[countArg]
4149
fileNames = get_filename()
4250
init(contestName, fileNames)
4351

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

4755
elif arg == "-h":
4856
help()

codeit/codeitHelp.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,12 @@ def help():
1313

1414
print(colored.cyan("A CLI Script tool to help you initialize CPP files for any contest"))
1515
print('\nCommands:\n')
16-
print(colored.magenta("codeit <flags> <args>\n"))
16+
print(colored.magenta("codeit <args> <filename/contestname>\n"))
1717
print(colored.red('Args list\n'))
18-
print(colored.yellow("-h \n" + colored.blue("To display help menu")))
19-
print(colored.yellow("-i <contest> \n" + colored.blue("To initialize a contest directory")))
20-
print(colored.yellow("-i -b <contest> \n" + colored.blue("To initialize a contest directory for practice and beginner level")))
21-
print(colored.yellow("-i <args> -ne <contest> \n" + colored.blue("To initialize a contest directory without error.txt file")))
22-
print(colored.yellow("-i -n <file> \n" + colored.blue("To initialize only a single file")))
23-
print(colored.yellow("-v \n" + colored.blue("To print version number")))
18+
print(colored.yellow("-h -------------------------- " + colored.blue("To display help menu")))
19+
print(colored.yellow("-i <contest> ----------------" + colored.blue("To initialize a contest directory")))
20+
print(colored.yellow("-i -b <contest> ------------- " + colored.blue("To initialize a contest directory for practice and beginner level")))
21+
print(colored.yellow("-i <args> -ne <contest> ----- " + colored.blue("To initialize a contest directory without error.txt file")))
22+
print(colored.yellow("-i <args> -t2 <contest> ----- " + colored.blue("To initialize a contest directory and use 2nd template without error.txt file")))
23+
print(colored.yellow("-i -n <file> ---------------- " + colored.blue("To initialize only a single file")))
24+
print(colored.yellow("-v -------------------------- " + colored.blue("To print version number")))

codeit/codeitInit.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import os
22
from clint.textui import colored
3-
from codeit.codeitMeta import template_cp
3+
from codeit.codeitMeta import template_cp, template_agg
44

55
def write_to_file(filename, text, contestName=None):
66
full_filename = os.path.join(os.getcwd(), filename)
@@ -41,4 +41,21 @@ def init_noerror(contestName, fileNames):
4141
# create input file
4242
write_to_file('input.txt', '', contestName)
4343
write_to_file('output.txt', '', contestName)
44+
print(colored.green('Files have been created without error TXT file. Happy Coding!'))
45+
46+
# For template 2
47+
def init_noerror_agg(contestName, fileNames):
48+
try:
49+
print(colored.blue('Making files and folders for ' + colored.magenta(contestName)))
50+
os.makedirs(os.path.join(os.getcwd(), contestName))
51+
except OSError:
52+
print(colored.red("Failed! This directory cannot be created as it exists."))
53+
else:
54+
print(colored.yellow('Directory is made'))
55+
# create files for contest (should be 6 cpp files)
56+
for files in range(len(fileNames)):
57+
write_to_file(fileNames[files], template_agg(), contestName)
58+
# create input file
59+
write_to_file('input.txt', '', contestName)
60+
write_to_file('output.txt', '', contestName)
4461
print(colored.green('Files have been created without error TXT file. Happy Coding!'))

codeit/codeitMeta.py

Lines changed: 66 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#Default template
12
def template_cp():
23
template = """#include <bits/stdc++.h>
34
@@ -29,4 +30,68 @@ def get_filename():
2930

3031
def get_fn_beginner():
3132
fileNames = ['A.cpp','B.cpp','C.cpp']
32-
return fileNames
33+
return fileNames
34+
35+
# Template 2
36+
def template_agg():
37+
temp = """#pragma GCC optimize("Ofast")
38+
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma")
39+
#pragma GCC optimize("unroll-loops")
40+
#include <bits/stdc++.h>
41+
#include <complex>
42+
#include <queue>
43+
#include <set>
44+
#include <unordered_set>
45+
#include <list>
46+
#include <chrono>
47+
#include <random>
48+
#include <iostream>
49+
#include <algorithm>
50+
#include <cmath>
51+
#include <string>
52+
#include <vector>
53+
#include <map>
54+
#include <unordered_map>
55+
#include <stack>
56+
#include <iomanip>
57+
#include <fstream>
58+
59+
using namespace std;
60+
61+
typedef long long ll;
62+
typedef long double ld;
63+
typedef pair<int,int> p32;
64+
typedef pair<ll,ll> p64;
65+
typedef pair<double,double> pdd;
66+
typedef vector<ll> v64;
67+
typedef vector<int> v32;
68+
typedef vector<vector<int> > vv32;
69+
typedef vector<vector<ll> > vv64;
70+
typedef vector<vector<p64> > vvp64;
71+
typedef vector<p64> vp64;
72+
typedef vector<p32> vp32;
73+
ll MOD = 998244353;
74+
double eps = 1e-12;
75+
#define forn(i,e) for(ll i = 0; i < e; i++)
76+
#define forsn(i,s,e) for(ll i = s; i < e; i++)
77+
#define rforn(i,s) for(ll i = s; i >= 0; i--)
78+
#define rforsn(i,s,e) for(ll i = s; i >= e; i--)
79+
#define dbg(x) cout<<#x<<" = "<<x<<ln
80+
#define mp make_pair
81+
#define pb push_back
82+
#define fi first
83+
#define se second
84+
#define INF 2e18
85+
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
86+
#define all(x) (x).begin(), (x).end()
87+
#define sz(x) ((ll)(x).size())
88+
89+
90+
int main()
91+
{
92+
fast_cin();
93+
//Code
94+
return 0;
95+
}
96+
"""
97+
return temp

setup.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@
22

33
setup(
44
name='codeit',
5-
version='0.0.2',
5+
version='0.0.3',
66
author='Aadhitya A',
7-
description = 'A CLI tool to create CPP files',
8-
long_description = README,
7+
description = 'A CLI tool to create CPP files for any contest',
98
license = 'GPL-3.0',
109
packages=find_packages(),
1110
install_requires=[

0 commit comments

Comments
 (0)