Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,19 @@
# SyncBoostNote
Python script to sync your Notes from BoostNote into a github repo.

TODOS:
- [ ] Have tags at a newline together and seperate from other shields.
- [ ] MAke syncboostnotes directory.
- [ ] Make Python Package.
- [ ] Make this repo Pulic.
- [ ] Generate README
- [ ] Sort the names by tag.
- [ ] Sort the names by date.
- [ ] sort the names by name (alphabetically)
- [ ] Sick boi.
- [ ] Puts checks for, if the ".md" is somehow deleted, put it back in.
- [ ] Brings in Opps.

## Thanks to this repo:
- pycson
- This reduced alot of the load.
5 changes: 5 additions & 0 deletions SyncBoostNote/bns.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
BOOSTNOTE_PATH: ~/BoostNotes
FREQUENCY: hourly
SHIELDS: true
SHIELDS_TYPE: for-the-badge
TIME: 1200
105 changes: 105 additions & 0 deletions SyncBoostNote/cli.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
import argparse
import json
import os
import shutil
import site
import sys
import textwrap
import time
import warnings

from colorama import Fore, init

from config import Config, interactive, config_reader
from test import ultimate

init(autoreset=True)


def options():
'''
Parsing the Arguments here
'''
ap = argparse.ArgumentParser(
prog="projectpy",
usage="%(prog)s [options]",
formatter_class=argparse.RawDescriptionHelpFormatter,
description=textwrap.dedent('''SyncBoostNotes
=======================================
- A CLI to Sync your BoostNotes Notes -
=======================================
'''))

ap.add_argument("-l", "--location", required=True,
help="Location of the BoostNotes local storage.")

ap.add_argument(
"-c",
"--config",
required=False,
help="Location of the config.yaml/config.yml file",
default=True)

ap.add_argument(
"-col",
"--color",
required=False,
help="Toggle Colors on the print",
default=True)

ap.add_argument(
"-g",
"--generate",
required=False,
help="Generate config.yaml file for ya",
default=True)

ap.add_argument(
"-i",
"--interactive",
required=False,
help="Get an Interactive prompt to fill the forms.",
default=False)

return vars(ap.parse_args())


def initialize(args):
'''
Sets the Config for the installation
'''
if args['interactive']:
print('>>> Interactive <<<')
return interactive()

elif args['config']:
print('>>> CUSTOM <<<')
ultimate(config_reader('./config.yaml'))

else:
# ! Weird
raise Exception('Weird')


def main():
args = options()
initialize(args)


def run_as_command():
main()


run_as_command()
# print(
# '''
# _________________________________
# | |
# | Generation was successful |
# | Below is the generated config: |
# | ------------------------- |
# | $ cd repo_name |
# | $ python setup.py install |
# ------------------------------
# '''
# )
71 changes: 71 additions & 0 deletions SyncBoostNote/config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
import yaml
import sys
import os
import readline
import json

home = os.path.expanduser("~")


class git_commands:
add = "git add -A"
commit = "git commit -m {}"
status = "git status"
push = "git push origin master"


Config = {
"BOOSTNOTE_PATH": "~/BoostNotes",
"SHIELDS": True,
"SHIELDS_TYPE": "for-the-badge",
"FREQUENCY": "hourly",
"TIME": 1200
}


def interactive():
conf = {}
questions = [
['BOOSTNOTE_PATH: ', ' ~/BoostNotes', 'BOOSTNOTE_PATH'],
['SHIELDS: ', ' True', 'SHIELDS'],
['SHIELDS_TYPE: ', 'for-the-badge', 'SHIELDS_TYPE'],
# ["hourly", "daily", "weekly", "monthly", "onchange"]
['FREQUENCY: ', 'hourly', 'FREQUENCY'],
['TIME: ', '1200', 'TIME'], # 24 gour format for now

]
for question in questions:
conf[question[2]] = input_with_prefill(question[0], question[1])
print(json.dumps(
conf, indent=2
))
return conf


def config_reader(location):
config = yaml.load(open(location), Loader=yaml.Loader)
print(json.dumps(config, indent=2))
return config


def input_with_prefill(prompt, text):
def hook():
readline.insert_text(text)
readline.redisplay()
readline.set_pre_input_hook(hook)
result = input(prompt)
readline.set_pre_input_hook()
return result


def create_config(location='.'):
'''
Creates a default config for users to see.
'''
yaml.dump(
Config,
open(os.path.join(location, 'bns.yaml'), 'w+')
)


# create_config()
7 changes: 7 additions & 0 deletions SyncBoostNote/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
BOOSTNOTE_PATH: ~/BoostNotes

SHIELDS: True
SHIELDS_TYPE: "for-the-badge"

FREQUENCY: hourly # ["hourly", "daily", "weekly", "monthly"]
TIME: 12 # 24 Hour format for now
38 changes: 38 additions & 0 deletions SyncBoostNote/history.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"48b6616e-2dae-4a4e-a86e-e8133bcdbe05.cson": {
"title": "Snippet note example",
"updated": false
},
"a0681b02-531d-4212-b35e-3bab8b60beea.cson": {
"title": "create-python-project",
"updated": false
},
"b8b2dcb5-8c0e-43bf-84ab-0a7605bf31c1.cson": {
"title": "\ud83d\udd34 THIS DOCUMENTATION IS WIP and will be completed soon.",
"updated": false
},
"2a3fd7c0-8c21-472a-bf95-05ea84d0d41e.cson": {
"title": "Day: Monday",
"updated": false
},
"a7469891-2c80-41e0-b7be-e1c6f05f92a5.cson": {
"title": "TEST",
"updated": false
},
"cc0c17cb-25bb-45f6-bdf0-fc8b54e88bb2.cson": {
"title": "Day: Tuesday Date: June 18",
"updated": false
},
"43cbad10-3808-42c2-8439-1478b45b6293.cson": {
"title": "DAY: SUNDAY",
"updated": false
},
"b008ef56-e95c-4a09-9268-349bd4fbf77d.cson": {
"title": "",
"updated": false
},
"8d91b880-2462-4a8b-a914-1712b8579bc1.cson": {
"title": "Welcome to Boostnote!",
"updated": false
}
}
Loading