Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 93ace67

Browse files
committed
A lot of stuff
Ignore the 'pref.pref~' file, I don't know why it's there.
1 parent 0c3f133 commit 93ace67

File tree

6 files changed

+119
-18
lines changed

6 files changed

+119
-18
lines changed

‎api++.depend‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,8 @@
22
1585702678 source:c:\code\api++\main.cpp
33
<iostream>
44

5+
1586124066 source:c:\code\apipp\main.cpp
6+
<iostream>
7+
<string>
8+
<fstream>
9+

‎bin/Debug/api++.exe‎

4.84 KB
Binary file not shown.

‎main.cpp‎

Lines changed: 113 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,38 +4,44 @@
44

55
using namespace std;
66

7+
//declare all wariables
78
string newApiOp;
89
string fileType;
910
bool javascriptFile;
1011
string repoSearchType;
11-
1212
string singleRepoOwner;
1313
string singleRepoName;
1414
string singleUrl;
15-
1615
string repoName;
1716
string repoFullName;
1817
string repoDesc;
1918
string repoHtmlUrl;
20-
2119
string fileName = "newApi++File";
2220
string filePath = "C:\\code\\api++";
2321
string fullFilePath;
2422
string fullFilePathConfirm;
25-
2623
string fileIdValue = "apiresultsapi++";
27-
2824
string fileTitleLink;
2925
string fileTitleLinkCustom = "#";
3026
string fileTitleClassName;
31-
3227
string fileFullNameClassName;
28+
string listLinkExist;
29+
bool startup = true;
30+
string prefsName;
31+
string prefsColon;
32+
string prefsValue;
3333

34-
int main()
35-
{
34+
int main() {
35+
//start API++
36+
int prefs();
37+
if (startup == true) {
38+
return prefs();
39+
startup = false;
40+
}
41+
cout << "API++ starting..." << endl;
42+
cout << "Reading prefs file..." << endl;
43+
system("title API++");
3644
int apiSys();
37-
cout << "api++ starting..." << endl;
38-
cout << "Reading prefs file...(FUTURE FEATURE)" << endl;
3945
cout << "Start new api operation? [Y/N] ";
4046
cin >> newApiOp;
4147
system("cls");
@@ -54,7 +60,7 @@ int main()
5460
}
5561
}
5662
else {
57-
cout << "exiting..." << endl;
63+
cout << "Exiting..." << endl;
5864
system("pause");
5965
return 0;
6066
}
@@ -63,9 +69,10 @@ int main()
6369
int apiSys() {
6470
int fileSys();
6571
system("cls");
72+
//fetch type of embed
6673
cout << "This application currently only supports GitHub's API system." << endl;
6774
cout << "For your own reference the base URL is https://api.github.com/" << endl;
68-
cout << "Choose whether you would like to embed a single repository or a list (found using filters). [R (single repo)/L (list of repos) [FUTURE RELEASE] ";
75+
cout << "Choose whether you would like to embed a single repository or a list (found using filters). [R (single repo)/L (list of repos) ";
6976
cin >> repoSearchType;
7077
system("cls");
7178
if (repoSearchType == "R" || repoSearchType == "r") {
@@ -95,13 +102,52 @@ int apiSys() {
95102
system("cls");
96103
return fileSys();
97104
}
105+
else if (repoSearchType == "l" || "L") {
106+
cout << "There are many ways to get a list of repositories. With GitHub you have to search with a filter." << endl;
107+
cout << "To get a full list of filters, go to https://help.github.com/en/github/searching-for-information-on-github/searching-for-repositories" << endl;
108+
cout << "Do you already have a search API URL? [Y/N] ";
109+
cin >> listLinkExist;
110+
system("cls");
111+
if (listLinkExist == "y" || listLinkExist == "Y") {
112+
cout << "Great that will make this a lot easier!" << endl;
113+
}
114+
else if (listLinkExist == "n" || listLinkExist == "N") {
115+
cout << "Type the filter you want to use." << endl;
116+
cout << "Filter by in the name [inname] \
117+
\nFilter by in the description [indesc] \
118+
\nFilter by in the README [inreadme] \
119+
\nFilter by user's name [username] \
120+
\nFilter by organization [orgname] \
121+
\nFilter by size (MB size.) [exactsize (filter by repos with exact size) / (there are other options that are not built in to API++ yet)] \
122+
\nFilter by number of followers [follown / (there are other options that are not built in to API++ yet)] \
123+
\nFilter by number of forks [forksn / (there are other options that are not built in to API++ yet)] \
124+
\nFilter by number of stars [starsn / (there are other options that are not built in to API++ yet)] \
125+
\nFilter by date created [datec] \
126+
\nFilter by date pushed [datep] \
127+
\nFilter by language [lang] \
128+
\nFilter by topic [topic] \
129+
\nFilter by number of topics [topicsn] \
130+
\nFilter by license keyword [license] \
131+
\nFilter by public or private [pubpri] \
132+
\nFilter by whether a repo is a mirror or not [mirror] \
133+
\nFilter by whether a repo has been archived or not [arch] \
134+
" << endl;
135+
return fileSys();
136+
}
137+
else {
138+
cout << "Whoops! Not one of your options! (API++ is still going to say you don't have a link)" << endl;
139+
return fileSys();
140+
}
141+
}
98142
else {
99-
cout << "Sorry! The only option you have right now is to embed one repository at a time. Make sure to type R next time." << endl;
143+
cout << "Not one of your options" << endl;
100144
system("cls");
101145
return apiSys();
102146
}
103147
}
104148
int fileSys() {
149+
int singleFile();
150+
int listFile();
105151
ofstream file;
106152
//get file info
107153
if (javascriptFile == true) {
@@ -127,8 +173,22 @@ int fileSys() {
127173
cout << fullFilePath << endl;
128174
cin >> fullFilePathConfirm;
129175
system("cls");
130-
176+
//confirm that user is satisfied with full file path
131177
if (fullFilePathConfirm == "Y" || fullFilePathConfirm == "y") {
178+
if (repoSearchType == "r" || repoSearchType == "R") {
179+
return singleFile();
180+
}
181+
else if (repoSearchType == "l" || repoSearchType == "L") {
182+
return listFile();
183+
}
184+
}
185+
//return back to filesys if user is not satisfied
186+
else {
187+
return fileSys();
188+
}
189+
}
190+
int singleFile() {
191+
system(("title API++ - New file: "+ fullFilePath).c_str());
132192
ofstream file((fullFilePath).c_str());
133193
if (javascriptFile == false) {
134194
file << "<!DOCTYPE html>" << endl;
@@ -164,7 +224,7 @@ int fileSys() {
164224
//repo title
165225
if (repoName == "Y" || repoName == "y") {
166226
file << "console.log('name result: ' + result.name)" << endl;
167-
cout << "Should the title element have link? [C (custom link)/R (repo link)/N (no)" << endl;
227+
cout << "Should the title element have link? [C (custom link)/R (repo link)/N (no)] ";
168228
cin >> fileTitleLink;
169229
system("cls");
170230
if (fileTitleLink == "R" || fileTitleLink == "r") {
@@ -219,14 +279,49 @@ int fileSys() {
219279
}
220280
file << "}" << endl;
221281

282+
//finish html file (if applicable)
222283
if (javascriptFile == false) {
223284
file << "</script>" << endl;
224285
file << "</body>" << endl;
225286
file << "</html>" << endl;
226287
cout << "Make sure to add an element with ID value: " << fileIdValue << "!" << endl;
227288
}
289+
}
290+
int listFile() {
291+
system(("title API++ - New file: "+ fullFilePath).c_str());
292+
cout << "This part of the program is not here yet." << endl;
293+
system("pause");
294+
return 0;
295+
}
296+
int prefs() {
297+
//read prefs
298+
ifstream prefs;
299+
prefs.open("pref.pref");
300+
301+
if (prefs.is_open()) {
302+
while (prefs >> prefsName >> prefsColon >> prefsValue) {
303+
if (prefsColon == ":") {
304+
if (prefsName == "theme") {
305+
if (prefsValue == "dark") {
306+
system("color 07");
307+
}
308+
else if (prefsValue == "light") {
309+
system("color 70");
310+
}
311+
else {
312+
system(("color" + prefsValue).c_str());
313+
}
314+
}
315+
else {
316+
cout << "Unknown pref..." << endl;
317+
}
318+
}
228319
}
229-
else {
230-
return fileSys();
231-
}
320+
prefs.close();
321+
}
322+
else {
323+
cout << "Prefs file is not open." << endl;
324+
}
325+
startup = false;
326+
return main();
232327
}

‎obj/Debug/main.o‎

7.7 KB
Binary file not shown.

‎pref.pref‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
theme : light

‎pref.pref~‎

Whitespace-only changes.

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /