Skip to content

Commit 04e85a1

Browse files
Merge pull request #64 from guptaaastha/emojis
Add emojis in Dynamic CLI [closed #64 ]
2 parents 3e40d5a + edfd9ee commit 04e85a1

File tree

4 files changed

+58
-21
lines changed

4 files changed

+58
-21
lines changed

README.md

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,28 @@
11
![dynamic-cli](https://socialify.git.ci/IndianOpenSourceFoundation/dynamic-cli/image?description=1&descriptionEditable=A%20Modern%2C%20user-friendly%20command-line%20%20for%20the%20API%20testing%2C%20and%20if%20you%27re%20stuck%20-%20Search%20and%20browse%20StackOverflow%20without%20leaving%20the%20CLI&font=Inter&forks=1&issues=1&language=1&owner=1&pattern=Plus&pulls=1&stargazers=1&theme=Light)
22

3-
4-
53
## Setup
64

75
**1.** Installing pip [Python Package Manager]
8-
```shell
6+
7+
```shell
98
$ sudo apt-get install python3-pip
109
```
1110

1211
**2.** Clone this repository to your local drive
13-
```shell
12+
13+
```shell
1414
$ git clone https://github.com/IndianOpenSourceFoundation/dynamic-cli.git
1515
```
1616

17-
**3.** Install dependencies
18-
```shell
17+
**3.** Install dependencies
18+
19+
```shell
1920
$ pip3 install -r requirements.txt
2021
```
2122

2223
**4.** Install with pip
23-
```shell
24+
25+
```shell
2426
$ pip3 install -e .
2527
```
2628

@@ -31,26 +33,26 @@ Dynamic CLI allows users to search for keywords/issues with some relevant tags.
3133
![ezgif com-gif-maker (1)](https://user-images.githubusercontent.com/49693160/111326116-4bcceb00-8692-11eb-9d3a-51350a006d34.gif)
3234

3335
## Arguments
36+
3437
Usage: Dynamic [OPTIONS] <br>
3538

3639
A Modern, user-friendly command-line HTTP client for the API testing, and if you're stuck - Search and browse StackOverflow without leaving the CLI. <br>
3740

3841
Options: <br>
3942

43+
`-st, --start -> Introduces Dynamic CLI` <br>
4044
`-v, --version -> Gives the Version of the CLI` <br>
4145
`-s, --search -> Search a question on Stackoverflow` <br>
4246
`-d, --debug -> Turn on Debugging mode` <br>
4347
`-h, --help -> Shows this message and exit` <br>
4448

45-
4649
## License
4750

48-
4951
### Contributing
5052

5153
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat&logo=git&logoColor=white)](https://github.com/IndianOpenSourceFoundation/dynamic-cli/pulls) [![Open Source Love](https://badges.frapsoft.com/os/v2/open-source.svg?v=103)](https://github.com/IndianOpenSourceFoundation/dynamic-cli)
5254

53-
**We're accepting PRs for our open and unassigned [issues](https://github.com/IndianOpenSourceFoundation/dynamic-cli/issues)**. Please check [CONTRIBUTING.md](CONTRIBUTING.md). We'd love your contributions! **Kindly follow the steps below to get started:**
55+
**We're accepting PRs for our open and unassigned [issues](https://github.com/IndianOpenSourceFoundation/dynamic-cli/issues)**. Please check [CONTRIBUTING.md](CONTRIBUTING.md). We'd love your contributions! **Kindly follow the steps below to get started:**
5456

5557
**1.** Fork [this](https://github.com/IndianOpenSourceFoundation/dynamic-cli) repository.
5658

@@ -67,6 +69,14 @@ cd dynamic-cli
6769
```
6870

6971
**4.** Make changes in source code.
72+
<br />
73+
P.S. If you want to add emojis 😁, use `unicodes`.
74+
Emoji `unicodes` can be found at [https://unicode.org/emoji/charts/full-emoji-list.html](https://unicode.org/emoji/charts/full-emoji-list.html)
75+
<br />
76+
To include an emoji in a string, copy the unicode (Eg: `U+1F600`), replace `+` with `000` and
77+
prefix it with a `\`.
78+
<br />
79+
Eg: `\U0001F604`
7080

7181
**5.** Stage your changes and commit
7282

@@ -89,6 +99,7 @@ git push
8999
**9.** **Congratulations!** Sit and relax, you've made your contribution to Dynamic-CLI project.
90100

91101
## Contributors:
102+
92103
### Credit goes to these people:✨
93104

94105
<table>

main.py

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,14 @@
66
version = "0.1"
77

88
parser = argparse.ArgumentParser()
9+
parser.add_argument("-st",
10+
"--start",
11+
help="introduce you to dynamic",
12+
action="store_true")
13+
914
parser.add_argument("-s",
1015
"--search",
11-
help="enable debug mode",
16+
help="search a question on StackOverflow",
1217
action="store_true")
1318

1419
parser.add_argument("-V",
@@ -19,7 +24,7 @@
1924
parser.add_argument(
2025
"-n",
2126
"--new",
22-
help="Opens browser to create new Stack Overflow question.",
27+
help="Opens browser to create new StackOverflow question.",
2328
const=True,
2429
metavar="title (optional)",
2530
nargs="?")
@@ -34,4 +39,16 @@
3439
search_flag = Search(ARGV)
3540

3641
if __name__ == "__main__":
37-
search_flag.search_args()
42+
if ARGV.start:
43+
print('''
44+
\U0001F604 Hello and Welcome to Dynamic CLI
45+
\U0001F917 Use the following commands to get started
46+
\U0001F50E Search on StackOverflow with '-s'
47+
\U0001F4C4 Open browser to create new Stack Overflow question with '-n [title(optional)]'
48+
\U0001F4C2 Save answer to a file with '-file'
49+
\U00002728 Know the version of Dynamic CLI with '-V'
50+
\U0001F609 See this message again with '-st'
51+
\U00002755 Get help with '-h'
52+
''')
53+
else:
54+
search_flag.search_args()

src/arguments/search.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def prompt(self):
1717
print(colored(f"{self.message} : ", 'cyan'), end='')
1818
data = input()
1919
if data == "":
20-
SearchError("Input data empty", "Please try again ")
20+
SearchError("\U0001F613 Input data empty", "\U0001F504 Please try again ")
2121
sys.exit()
2222
else:
2323
return str(data)
@@ -47,7 +47,7 @@ def search_for_results(self, save=False):
4747
# ask quesiton
4848
for each_query in queries:
4949
# Be careful if there are
50-
# KeyBpard Interupts or EOErrors
50+
# KeyBoard Interrupts or EOErrors
5151
try:
5252
prompt = Prompt(str(each_query)).prompt()
5353
except:
@@ -60,12 +60,21 @@ def search_for_results(self, save=False):
6060
questions = self.utility_object.get_que(json_output)
6161
if questions == []:
6262
# evoke an error
63-
search_error = SearchError("No answer found", "Please try reddit")
63+
search_error = SearchError("\U0001F613 No answer found", "\U0001F604 Please try reddit")
6464
else:
6565
data = self.utility_object.get_ans(questions)
66+
print('''
67+
\U0001F604 Hopefully you found what you were looking for!
68+
\U0001F4C2 You can save an answer to a file with '-file'
69+
70+
Not found what you were looking for \U00002754
71+
\U0001F4C4 Open browser and post your question on StackOverflow with '-n [title (optional)]'
72+
73+
\U0001F50E To search more use '-s'
74+
''')
6675

6776
if save:
6877
filename = SaveSearchResults(data)
6978
print(
70-
colored(f"Answers successfully saved into {filename}",
79+
colored(f"\U0001F604 Answers successfully saved into {filename}",
7180
"green"))

src/arguments/utility.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ def make_request(self, que, tag: str):
2929
:return: Json response from the api call.
3030
:rtype: Json format data
3131
"""
32-
print("Searching for the answer")
32+
print("\U0001F50E Searching for the answer")
3333
try:
3434
resp = requests.get(self.__get_search_url(que, tag))
3535
except:
36-
SearchError("Search Failed", "Try connecting to the internet")
36+
SearchError("\U0001F613 Search Failed", "\U0001F4BB Try connecting to the internet")
3737
sys.exit()
3838
return resp.json()
3939

@@ -52,7 +52,7 @@ def get_ans(self, questions_list):
5252
f"{self.search_content_url}/2.2/questions/{questions_list[questions]}/answers?order=desc&sort=votes&site=stackoverflow&filter=!--1nZwsgqvRX"
5353
)
5454
except:
55-
SearchError("Search Failed", "Try connecting to the internet")
55+
SearchError("\U0001F613 Search Failed", "\U0001F4BB Try connecting to the internet")
5656
sys.exit()
5757
json_ans_data = resp.json()
5858

@@ -61,7 +61,7 @@ def get_ans(self, questions_list):
6161
colored(
6262
"--------------------------------------------------------",
6363
'red'), data["body_markdown"],
64-
f"Link to the answer:{data['link']}"
64+
f"\U0001F517 Link to the answer:{data['link']}"
6565
]
6666

6767
for output_index, output_text in enumerate(output_content):

0 commit comments

Comments
 (0)