Skip to content

Commit d67c882

Browse files
committed
readme update + print formatting
1 parent 79a71b7 commit d67c882

File tree

2 files changed

+32
-13
lines changed

2 files changed

+32
-13
lines changed

README.md

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,31 @@ Github Username: ketankr9
2525
Github Email: [email protected]
2626
```
2727

28+
## Configuration
29+
**Languages Supported**: *cpp*(C++17) \[default\], *java*, *python*(CPython3), *javascript*(Node.js)
30+
Also you can manually edit the config at ```~/.cses/config.json```
31+
```
32+
$$$ cat ~/.cses/config.json
33+
{
34+
"csrf": "3e236b578af1e020070281xxxxxxxxxx",
35+
"username": "test123xyz",
36+
"cookie": "PHPSESSID=e17c5cae7fcxxxxxxxxxa7d14ee120fc4fb859c; path=/",
37+
"root": "/home/username/.cses",
38+
"editor": "atom",
39+
"lang": "java",
40+
"github": {
41+
"token": "1f10d6065e78a2654a14xxxxxxxxxxxxxxxxxxxx",
42+
"repository": "cses-solutions",
43+
"username": "ketankr9",
44+
"email": "[email protected]"
45+
}
46+
}
47+
```
2848
## Screenshot
2949
```
3050
$$$ cses-cli login
3151
Username: test123xyz
32-
Password: qwertyui
52+
Password: [<DELETED>]
3353
Logged in successfully
3454
3555
$$$ cses-cli list
@@ -101,19 +121,18 @@ $$$ cses-cli solve 1068
101121
3 10 5 16 8 4 2 1
102122
103123
$$$ cses-cli submit 1068.task.cpp
104-
TESTING ⠇
105124
Task:Weird Algorithm
106125
Sender:test123xyz
107126
Submission time:2020-03-07 13:56:29
108127
Language:C++17
109128
Status:READY
110129
Result:ACCEPTED
111-
Comitting to Github[===> ]
130+
Github: cses-solutions
112131
```
113132

114133
>I will add support for these features only if people show some love to this repo since current commit suffices my need.
115134
116-
* Supports only C++ currently, will add support for other languages on request.
117-
* A modifiable template code file.
135+
* Supports only C++ currently, will add support for other languages on request. **UPDATE: Done**
136+
* A modifiable template code file. **UPDATE: Done**
118137
* Auto commit to Github repository **UPDATE: Done**
119138
* Clean LaTex based $equation$ from problem statement. Eg $1 ≤ n ≤ 10^6$

project/main.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -139,14 +139,14 @@ func printResult(link string, sess *Session) bool {
139139
s := spinner.New(spinner.CharSets[14], 100*time.Millisecond)
140140
s.Prefix = "PENDING "
141141
s.Start()
142-
defer s.Stop()
143142

144143
for true {
145144
status, text, verdict := printResultRequest(link, sess.Cookie)
146145
s.Prefix = status + " "
147146

148147
if status == "READY" || status == "COMPILE ERROR" || status == "" {
149-
fmt.Print("\n" + text)
148+
s.Stop()
149+
fmt.Print(text)
150150
if verdict == "ACCEPTED" {
151151
return true
152152
}
@@ -159,11 +159,10 @@ func printResult(link string, sess *Session) bool {
159159
func submit(sourceFile string, sess *Session) {
160160

161161
ext := filepath.Ext(sourceFile)
162-
task := strings.Split(filepath.Base(sourceFile), ".")[0]
163162

164163
opts := map[string]string{
165164
"csrf_token": sess.Csrf,
166-
"task": task,
165+
"task": strings.Split(filepath.Base(sourceFile), ".")[0],
167166
"lang": extLangMap[ext],
168167
"type": "course",
169168
"target": "problemset",
@@ -174,13 +173,14 @@ func submit(sourceFile string, sess *Session) {
174173

175174
if verdict := printResult(link, sess); verdict && validGithubConfig(&sess.Github) {
176175
s := spinner.New(spinner.CharSets[36], 100*time.Millisecond)
177-
s.Prefix = "Comitting to Github"
176+
s.Prefix = "Committing to Github"
178177
s.Start()
179-
defer s.Stop()
180178
if ok := updateFile(sourceFile, &sess.Github); ok {
181-
fmt.Println("✔")
179+
s.Stop()
180+
fmt.Println("Github: "+sess.Github.SourceRepo+" ✔")
182181
} else {
183-
fmt.Println("✘")
182+
s.Stop()
183+
fmt.Println("Github: ✘")
184184
}
185185
}
186186
}

0 commit comments

Comments
 (0)