https://github.com/evilmarty/safari-bookmarks-cli
A cli to manage bookmarks in the Safari web browser.
https://github.com/evilmarty/safari-bookmarks-cli
bookmarks browser cli python safari
Last synced: about 1 year ago
JSON representation
A cli to manage bookmarks in the Safari web browser.
- Host: GitHub
- URL: https://github.com/evilmarty/safari-bookmarks-cli
- Owner: evilmarty
- License: apache-2.0
- Created: 2023-08-14T10:59:03.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2024-04-18T08:39:54.000Z (about 2 years ago)
- Last Synced: 2024-05-02T00:24:50.728Z (about 2 years ago)
- Topics: bookmarks, browser, cli, python, safari
- Language: Python
- Homepage:
- Size: 43 KB
- Stars: 5
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# safari-bookmarks-cli
A cli to manage bookmarks in the Safari web browser.
This utility interacts with Safari's `Bookmarks.plist` file. When it detects changes it is reloaded without intervention.
**Note** macOS 10.14+ requires Full Disk Access for the application being used. ie. Terminal, iTerm, etc.
## Installation
You can install safari-bookmarks-cli via pip:
```shell
pip3 install safari-bookmarks-cli
# verify installation
safari-bookmarks --version
```
## Usage
The following assumes the default location for Safari's bookmarks, which is `~/Library/Safari/Bookmarks.plist`. If this is not the case you can specify an alternate location by passing the arguments `-f `.
For a full list of commands and options just run:
```shell
safari-bookmarks --help
```
### To list all bookmarks run
```shell
safari-bookmarks list
```
### To list all bookmarks in the menubar
```shell
safari-bookmarks list "BookmarksMenu"
```
### Add a new bookmark to the menubar
```shell
safari-bookmarks add --title "New bookmark" --url "http://example.com" "BookmarksMenu"
```
### Add a new bookmark to the menu
```shell
safari-bookmarks add --title "New folder" --list "BookmarksBar"
```
### Move a bookmark to a different folder
```shell
safari-bookmarks move "BookmarksMenu" "New bookmark" --to "BookmarksBar" "New folder"
```
### Remove a bookmark or folder
**Note** removing a folder will also remove all bookmarks and folders within it.
```shell
safari-bookmarks remove "BookmarksBar" "New folder"
```
### Empty a folder
```shell
safari-bookmarks empty "BookmarksBar" "New folder"
```
## Testing
Clone the repository:
```shell
git clone https://github.com/evilmarty/safari-bookmarks-cli.git
```
Install pytest and flake8
```shell
pip3 install pytest flake8
```
Run them
```shell
pytest && flake8
```