-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #127 from ArjunSharda/2.4.0
2.4.0
- Loading branch information
Showing
9 changed files
with
133 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,30 @@ | ||
# Supported Options | ||
|
||
Searchor uses all of the Engines listed in the __init__.py in the CLI as well! | ||
This is a list of all the official supported CLI options of Searchor, with a example of them being used. | ||
|
||
# Copy URL | ||
You can do `$ searchor Google "Hello World!" --copy` as an example | ||
# Normal ✅ | ||
```shell | ||
$ searchor search Yahoo "Hello World!" | ||
|
||
# Open Web | ||
You can do `$ searchor Target "Hello World!" --open` as an example | ||
``` | ||
|
||
# Copy URL ✅ | ||
```shell | ||
$ searchor search Google "Hello World!" --copy | ||
``` | ||
|
||
# Open Web ✅ | ||
|
||
```shell | ||
$ searchor search Target "Hello World!" --open | ||
``` | ||
|
||
# History ✅ | ||
```shell | ||
$ searchor history | ||
``` | ||
|
||
# Clear History ✅ | ||
```shell | ||
$ searchor history --clear | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from searchor import Engine | ||
|
||
Engine.new("Custom", "https://www.example.com/search?q=") | ||
|
||
print(Engine.Custom.search("Hello, World!")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" | |
|
||
[project] | ||
name = "searchor" | ||
version = "2.3.2" | ||
version = "2.4.0" | ||
authors = [ | ||
{ name="Arjun Sharda", email="[email protected]" }, | ||
{ name="William Jackson", email="[email protected]" }, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import os | ||
import json | ||
import os.path | ||
from datetime import datetime | ||
|
||
DATA_PATH = os.path.join(os.getenv("HOME"), ".searchor-history.json") | ||
tmp = {"searches": []} | ||
|
||
|
||
def update(engine, query, url): | ||
search_data = { | ||
"url": url, | ||
"engine": engine, | ||
"query": query, | ||
"time": str(datetime.today().strftime("%I:%M %p")), | ||
} | ||
|
||
if not os.path.exists(DATA_PATH): # check if data file does not exist | ||
with open(DATA_PATH, "w") as history_file: | ||
json.dump(tmp, history_file) # create file if it does not exist | ||
with open(DATA_PATH, "+r") as history_file: | ||
history_data = json.load(history_file) | ||
history_data["searches"].append(search_data) | ||
history_file.seek(0) | ||
json.dump(history_data, history_file, indent=4) | ||
|
||
|
||
def clear(): | ||
if os.path.exists(DATA_PATH): | ||
with open(DATA_PATH, "w") as history_file: | ||
json.dump(tmp, history_file) | ||
|
||
|
||
def view(): | ||
with open(DATA_PATH, "+r") as history_file: | ||
history_data = json.load(history_file) | ||
for search in history_data["searches"]: | ||
print(f"{search['time']}: {search['url']}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters