Giter Club home page Giter Club logo

kb's Issues

Question: Can we set background color in templates?

Hi,

great program, thanks for sharing!

Question

Can we use background from?

For example:

TemplateFileXY:
ERRORS = [ "^!.*", "light_red", "light_yellow"]

Expected Behavior

Display light red text on light yellow background for lines beginning with "!".

Actual Behavior

Displays red text on terminal's current background.

Specifications

  • Version: kb v.0.1.6
  • Platform: Windows 10.0.19042

Thanks!

BR
Tomo

`add` and `edit` commands error if $EDITOR set to "vim -u ~/my-vimrc"

Expected Behavior

add and edit commands work.

Actual Behavior

add and edit commands don't work if $EDITOR is set to "vim -u ~/my-vimrc", but work if set to just "vim".

$ echo "${EDITOR}"
vim -u ~/my-vimrc

$ kb add -t 'test title test'
Traceback (most recent call last):
  File "/usr/local/bin/kb", line 33, in <module>
    sys.exit(load_entry_point('kb==0.1.1', 'console_scripts', 'kb')())
  File "/usr/local/lib/python3.8/site-packages/kb-0.1.1-py3.8.egg/kb/main.py", line 62, in main
    dispatch(cmd, cmd_params, config=DEFAULT_CONFIG)
  File "/usr/local/lib/python3.8/site-packages/kb-0.1.1-py3.8.egg/kb/main.py", line 52, in dispatch
    return COMMANDS[function](*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/kb-0.1.1-py3.8.egg/kb/commands/add.py", line 71, in add
    call([config["EDITOR"], Path(category_path, title)])
  File "/usr/local/Cellar/[email protected]/3.8.5/Frameworks/Python.framework/Versions/3.8/lib/python3.8/subprocess.py", line 340, in call
    with Popen(*popenargs, **kwargs) as p:
  File "/usr/local/Cellar/[email protected]/3.8.5/Frameworks/Python.framework/Versions/3.8/lib/python3.8/subprocess.py", line 854, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/local/Cellar/[email protected]/3.8.5/Frameworks/Python.framework/Versions/3.8/lib/python3.8/subprocess.py", line 1702, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'vim -u ~/my-vimrc'

Problems seem to be at the line call([config["EDITOR"], Path(category_path, title)]) in kb/commands/add.py and kb/commands/view.py.

Steps to Reproduce the Problem

touch ~/my-vimrc
EDITOR="vim -u ~/my-vimrc" kb add -t 'new title'
EDITOR="vim -u ~/my-vimrc" kb view -t 'new title'

Specifications

  • Version: Python 3.8.5
  • Platform: macOS Catalina 10.15.6
  • Subsystem: N/A

Exception thrown for `kb view --id 90` when 90 does not exist

Expected Behavior

I'd probably expect nothing to return.

Actual Behavior

Traceback (most recent call last):
  File "/usr/local/bin/kb", line 33, in <module>
    sys.exit(load_entry_point('kb', 'console_scripts', 'kb')())
  File "/Users/jake.robers/Code/kb/kb/main.py", line 62, in main
    dispatch(cmd, cmd_params, config=DEFAULT_CONFIG)
  File "/Users/jake.robers/Code/kb/kb/main.py", line 52, in dispatch
    return COMMANDS[function](*args, **kwargs)
  File "/Users/jake.robers/Code/kb/kb/commands/view.py", line 60, in view
    artifact = db.get_artifact_by_id(conn, artifact_id)
  File "/Users/jake.robers/Code/kb/kb/db.py", line 210, in get_artifact_by_id
    return Artifact(*cur.fetchall().pop())
IndexError: pop from empty list

Steps to Reproduce the Problem

View an archive that does not exist on your system.

  1. kb view --id 90 # 90 does not exist on my machine.

Code Page issue on Windows

Expected Behavior

Using: pip install -U kb-manager
or pip install -U git+https://github.com/gnebbia/kb

I expected to have kb installed

Actual Behavior

There is an error related to the code page:

Traceback (most recent call last):
  File "c:\python27\lib\runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "c:\python27\lib\runpy.py", line 72, in _run_code
    exec code in run_globals
  File "C:\Python27\Scripts\pip.exe\__main__.py", line 5, in <module>
  File "c:\python27\lib\site-packages\pip\__init__.py", line 28, in <module>
    from pip.vcs import git, mercurial, subversion, bazaar  # noqa
  File "c:\python27\lib\site-packages\pip\vcs\mercurial.py", line 9, in <module>
    from pip.download import path_to_url
  File "c:\python27\lib\site-packages\pip\download.py", line 37, in <module>
    from pip.utils.ui import DownloadProgressBar, DownloadProgressSpinner
  File "c:\python27\lib\site-packages\pip\utils\ui.py", line 57, in <module>
    _BaseBar = _select_progress_class(IncrementalBar, Bar)
  File "c:\python27\lib\site-packages\pip\utils\ui.py", line 50, in _select_progress_class
    six.text_type().join(characters).encode(encoding)
LookupError: unknown encoding: cp65001

Steps to Reproduce the Problem

  1. At the Windows command prompt.
  2. Use either:

Specifications

  • Version: Unknown - current
  • Platform: Windows 10
  • Subsystem:

Can we update category/tags after it's created?

I think it's nice if we can update it.
Also, I think it will be more convenient if the title/category/tags are included inside the note as well, so we don't need to specify title/category/tags in the command line when we add a new note, and we can update it easily when we want later.

So I imagine a flow like this:

  1. Adding new note: type kba, this will open a new file in the $EDITOR will the following structure:
# title: 
# category:
# tags:

Then we can add it there, it's nice to be able to add it in the editor, instead of from the command line

  1. Edit old note: type kbe 0, this will open the note, and allow us to update everything, from the content to title/category/tags

Build a vscode Extension

Hi there, i find the product through @yihong0618 on twitter, and it's fantastic. I was wondering if you could build a vscode extension. Considering the popularity of vscode , the product will be a smash-hit when the extension releases.

Android app

This is just an idea.

I'm self hosting most of my stuff. It would be great to be able to use kb from an Android phone.

We could sync the sqlite database using something like Syncthing, but I wonder if that could generate some problems if the database is modified by two devices at the same time...

Creating a new KB artifact from scratch fails on Windows 10

Expected Behavior

kb add --title "ftp" --category "notes" --tags "protocol;network"

brings up an editor

Actual Behavior

C:\Users\Uwe>kb add --title "ftp" --category "notes" --tags "protocol;network"
Traceback (most recent call last):
File "c:\anaconda3\lib\runpy.py", line 193, in _run_module_as_main
"main", mod_spec)
File "c:\anaconda3\lib\runpy.py", line 85, in run_code
exec(code, run_globals)
File "C:\Anaconda3\Scripts\kb.exe_main
.py", line 7, in
File "c:\anaconda3\lib\site-packages\kb\main.py", line 64, in main
dispatch(cmd, cmd_params, config=DEFAULT_CONFIG)
File "c:\anaconda3\lib\site-packages\kb\main.py", line 54, in dispatch
return COMMANDS[function](*args, **kwargs)
File "c:\anaconda3\lib\site-packages\kb\commands\add.py", line 80, in add
call(shell_cmd)
File "c:\anaconda3\lib\subprocess.py", line 339, in call
with Popen(*popenargs, **kwargs) as p:
File "c:\anaconda3\lib\subprocess.py", line 800, in init
restore_signals, start_new_session)
File "c:\anaconda3\lib\subprocess.py", line 1207, in _execute_child
startupinfo)
FileNotFoundError: [WinError 2] Das System kann die angegebene Datei nicht finden (cannot find the specified file)

Steps to Reproduce the Problem

  1. kb add --title "ftp" --category "notes" --tags "protocol;network"

Specifications

  • Version: 0.1.5
  • Platform: Windows 10
  • Subsystem: Python 3.7.9 (default, Aug 31 2020, 17:10:11) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32

AttributeError: module 'attr' has no attribute 's'

Expected Behavior

kb runs.

Actual Behavior

When trying to run it, there is an error:

$ kb                            
Traceback (most recent call last):
  File "/home/yala/.local/bin/kb", line 5, in <module>
    from kb.main import main
  File "/home/yala/.local/lib/python3.8/site-packages/kb/main.py", line 19, in <module>
    from kb.commands.add import add
  File "/home/yala/.local/lib/python3.8/site-packages/kb/commands/add.py", line 19, in <module>
    import kb.db as db
  File "/home/yala/.local/lib/python3.8/site-packages/kb/db.py", line 21, in <module>
    from kb.entities.artifact import Artifact
  File "/home/yala/.local/lib/python3.8/site-packages/kb/entities/artifact.py", line 18, in <module>
    @attr.s(auto_attribs=True, frozen=True, slots=True)
AttributeError: module 'attr' has no attribute 's'

Steps to Reproduce the Problem

  1. Install with pip3 install -U kb-manager
  2. Run with kb

Specifications

  • Version: Python 3.8
  • Platform: Ubuntu 20.10

Add "stats" functionality

Expected Behavior

New function:

stats

will return number of artefacts, number of tags, number of categories, number of authors and anything else that seems useful.

[request] use bat instead of cat

Is it possible to configure kb to use bat instead of cat when viewing notes and cheatsheets? for large files this will allow for easy scrolling.

XDG Compliance

Expected Behavior

Puts kb data in "${XDG_DATA_HOME:-$HOME/.local/share}/kb"

It would be great to follow the XDG Base Directory Specification and place application
data files in $XDG_DATA_HOME/kb, if it exists, and fall back to $HOME/.local/share/kb if that environment variable does not exist. It was mentioned offhand in this thread, but I would like to make an issue to address this :)

Actual Behavior

kb data put in ~/.kb.

Steps to Reproduce the Problem

Execute a kb command

Specifications

  • Version: 0.1.5
  • Platform: Linux
  • Subsystem: Arch

Un-named buffer on creating a new note

Expected Behavior

Vim should create a buffer with a name so that it can be saved after writing the note.

Actual Behavior

When creating a new note, for example,
kb add --title "ftp" --category "notes" --tags "protocol;network"
Vim created an un-named buffer, the note cannot be saved.

Specifications

  • Platform: Mac OS 10.15.5

Updating status updates author instead

Expected Behavior

I tried to update the status of a document

Actual Behavior

The Author was updated instead

Steps to Reproduce the Problem

  1. Added a file with a status of 'open'
  2. Ran >kb update --id 2 -s closed
  3. Did a verbose list and saw the author was 'closed' and the status was still 'open'

Specifications

  • Version: 0.12
  • Platform: Windows 10
  • Subsystem:

kb grep "IndexError: list index out of range"

Hi! It's me again. I've been working on migrating my notes into kb, and I ran across this error. I'm planning on looking into it a bit, but I wanted to open the issue first.

Expected Behavior

kb ought to display a list of artifacts containing the word, as shown in https://github.com/gnebbia/kb#grep-through-the-knowledge-base

Actual Behavior

kb throws an IndexError. This only seems to occur if the grep successfully matches an artifact. Nothing seems to change if I use the -v flag. It works if I use the -m flag to show the matching lines instead of the artifacts.

Ghostbin with full error: https://ghostbin.co/paste/tyqqos

Steps to Reproduce the Problem

  1. Run kb grep with any word that exists in the knowledge base.

Specifications

  • Version: kb-git from the AUR.
  • Platform: Arch Linux

AttributeError: 'str' object has no attribute 'mkdir'

Hi,

I am getting the following error

$ kb add test Traceback (most recent call last): File "/usr/local/bin/kb", line 11, in <module> load_entry_point('kb==0.1.1', 'console_scripts', 'kb')() File "/usr/local/lib/python3.6/site-packages/kb-0.1.1-py3.6.egg/kb/main.py", line 62, in main dispatch(cmd, cmd_params, config=DEFAULT_CONFIG) File "/usr/local/lib/python3.6/site-packages/kb-0.1.1-py3.6.egg/kb/main.py", line 52, in dispatch return COMMANDS[function](*args, **kwargs) File "/usr/local/lib/python3.6/site-packages/kb-0.1.1-py3.6.egg/kb/commands/add.py", line 50, in add initializer.init(config) File "/usr/local/lib/python3.6/site-packages/kb-0.1.1-py3.6.egg/kb/initializer.py", line 37, in init create_kb_files(config) File "/usr/local/lib/python3.6/site-packages/kb-0.1.1-py3.6.egg/kb/initializer.py", line 63, in create_kb_files kb_path.mkdir(parents=True, exist_ok=True) AttributeError: 'str' object has no attribute 'mkdir'

From what I can see in config.py these are indeed strings not "Path" objects

Running on RedHat 7.8

Linux xxx 3.10.0-1127.19.1.el7.x86_64 #1 SMP Tue Aug 11 19:12:04 EDT 2020 x86_64 x86_64 x86_64 GNU/Linux

SyntaxError: invalid syntax

Expected Behavior

work

Actual Behavior

not work

Steps to Reproduce the Problem

1.install kb
2.kb --version

Specifications

  • Version: 0.1.4
  • Platform: LInux
  • Subsystem: ubuntu16.04

File "/home/xx/env_python3/lib/python3.5/site-packages/kb_manager-0.1.4-py3.5.egg/kb/entities/artifact.py", line 20
id: Optional[int]
^
SyntaxError: invalid syntax

python3.6 not work

Expected Behavior

kb list or kb add work fine

Actual Behavior

kb list or kb add cause exceptions
image

I use docker-compose works fine

Steps to Reproduce the Problem

  1. using python3.6
  2. install kb
  3. kb list

Specifications

  • Version: python 3.6
  • Platform: windows
  • Subsystem: wsl1

Edit in external editor is broken

Expected Behavior

Edit artifact in external editor (specified in the %EDITOR% env variable)

Actual Behavior

Traceback (most recent call last):
  File "__main__.py", line 20, in <module>
  File "main.py", line 62, in main
  File "main.py", line 52, in dispatch
  File "commands\edit.py", line 44, in edit
  File "commands\edit.py", line 73, in edit_by_id
  File "subprocess.py", line 304, in call
  File "subprocess.py", line 756, in __init__
  File "subprocess.py", line 1100, in _execute_child
  File "subprocess.py", line 511, in list2cmdline
TypeError: argument of type 'WindowsPath' is not iterable
[7080] Failed to execute script __main__

Steps to Reproduce the Problem

  1. Add a file as artifact
  2. Edit the file with this command: kb edit --id "number"

Specifications

  • Version: 0.1.2
  • Platform: Windows

Missing Package: Metadata

Expected Behavior

expected 'kb list' to list execute.

Actual Behavior

The following error was raised:

Traceback (most recent call last):
  File "/usr/bin/kb", line 33, in <module>
    sys.exit(load_entry_point('kb==0.1.1', 'console_scripts', 'kb')())
  File "/usr/bin/kb", line 22, in importlib_load_entry_point
    for entry_point in distribution(dist_name).entry_points
  File "/usr/lib/python3.8/importlib/metadata.py", line 504, in distribution
    return Distribution.from_name(distribution_name)
  File "/usr/lib/python3.8/importlib/metadata.py", line 177, in from_name
    raise PackageNotFoundError(name)
importlib.metadata.PackageNotFoundError: kb

I expect that there is an additional requirement that needs to be specified? This running on Ubuntu 20.04.

KB contents are lost when a docker container is restarted

Expected Behavior

a docker-compose up -d, some processing of the kb in the container, a docker-compose down and then a later docker-compose up -d should have the results of your kb manipulations.

Actual Behavior

Changes to the knowledge base are not persisted.

Steps to Reproduce the Problem

  1. Start a container with docker-compose up -d
  2. Enter the container with docker-compose exec kb bash
  3. Add a note with kba ....
  4. Exit the container
  5. Stop the container with docker-compose down
  6. Restart the container with docker-compose up -d
  7. Enter the container with docker-compose exec kb bash
  8. Look for notes with kbl

Specifications

  • Version:
  • Platform:
  • Subsystem:

Typos discovered by codespell

% codespell . --ignore-words-list=hist --skip=./.* --quiet-level=2 || true

./README.md:60: shoud ==> should
./docs/README.md:60: shoud ==> should
./kb/filesystem.py:198: containint ==> containing
./kb/commands/grep.py:64: specied ==> specified

Upgrade to 0.1.6 did not upgrade typing_extensions or warn about compatibility issues

Expected Behavior

kb list
.... stuff

Actual Behavior

... yadda yadda yadda
from typing_extensions import Final, Literal, SupportsIndex # noqa: F401
ImportError: cannot import name 'SupportsIndex' frohm 'typing_extensions'

Steps to Reproduce the Problem

Specifications

  • Version: 0.1.8
  • Platform: Windows 10
  • Subsystem:

Note: I did resolve this by upgrading typing_extensions from 3.7.4 to 3.10.0.2

EDITOR on windows not being set

Expected Behavior

kb add opens the editor set in the EDITOR env var

Actual Behavior

Call to open editor fails, looking at code Im not seeing where it looks for env var it appears to use default config always which would point to vim?

Steps to Reproduce the Problem

  1. kb add --title "test" --category "note" --tags "test;firstnote"

Specifications

  • Version: 0.1.6
  • Platform: windows
  • Subsystem:

Please clarify the license this software is released under

Great job releasing this! It'll help a lot of people.

A quest question, there appear to be two licenses. One in the README and one in the LICENSE file. It's not clear whether this is released under BSD, GPLv3, or dual license. Can this be clarified? Thanks!

Expected Behavior

Single license

Actual Behavior

Two licenses

Steps to Reproduce the Problem

  1. Read the bottom of the README, see something that is or looks like 3-clause BSD
  2. Read LICENSE file, see GPLv3

Error when using "kb grep -m something"

Expected Behavior

Get the result of the grep with detailed search results

Actual Behavior

Got an exception :
Traceback (most recent call last):
File "/home/antoine/.pyenv/versions/3.7.5/bin/kb", line 11, in
load_entry_point('kb-manager==0.1.5', 'console_scripts', 'kb')()
File "/home/antoine/.pyenv/versions/3.7.5/lib/python3.7/site-packages/kb_manager-0.1.5-py3.7.egg/kb/main.py", line 64, in main
dispatch(cmd, cmd_params, config=DEFAULT_CONFIG)
File "/home/antoine/.pyenv/versions/3.7.5/lib/python3.7/site-packages/kb_manager-0.1.5-py3.7.egg/kb/main.py", line 54, in dispatch
return COMMANDS[function](*args, **kwargs)
File "/home/antoine/.pyenv/versions/3.7.5/lib/python3.7/site-packages/kb_manager-0.1.5-py3.7.egg/kb/commands/grep.py", line 66, in grep
printer.print_grep_matches(artifact_names)
TypeError: print_grep_matches() missing 1 required positional argument: 'hits_list'

Steps to Reproduce the Problem

  1. Simply use the command, I think...

Specifications

  • Version: 0.1.5
  • Platform: Linux
  • Subsystem: Ubuntu 20.04

Module 'attr' has no attribute 's'

Expected Behavior

Working Normally

Actual Behavior

 $ kb
Traceback (most recent call last):
  File "/usr/local/bin/kb", line 11, in <module>
    load_entry_point('kb-manager==0.1.5', 'console_scripts', 'kb')()
  File "/usr/lib/python3.8/site-packages/pkg_resources/__init__.py", line 489, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python3.8/site-packages/pkg_resources/__init__.py", line 2852, in load_entry_point
    return ep.load()
  File "/usr/lib/python3.8/site-packages/pkg_resources/__init__.py", line 2443, in load
    return self.resolve()
  File "/usr/lib/python3.8/site-packages/pkg_resources/__init__.py", line 2449, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/usr/local/lib/python3.8/site-packages/kb_manager-0.1.5-py3.8.egg/kb/main.py", line 19, in <module>
    from kb.commands.add import add
  File "/usr/local/lib/python3.8/site-packages/kb_manager-0.1.5-py3.8.egg/kb/commands/add.py", line 20, in <module>
    import kb.db as db
  File "/usr/local/lib/python3.8/site-packages/kb_manager-0.1.5-py3.8.egg/kb/db.py", line 21, in <module>
    from kb.entities.artifact import Artifact
  File "/usr/local/lib/python3.8/site-packages/kb_manager-0.1.5-py3.8.egg/kb/entities/artifact.py", line 17, in <module>
    @attr.s(auto_attribs=True, frozen=True, slots=True)
AttributeError: module 'attr' has no attribute 's'

Steps to Reproduce the Problem

  1. Install kb from pip
  2. Run kb

Specifications

  • Version: Python 3.8.6, kb 0.1.5
  • Platform: Fedora 32 SilverBlue

Have same issue? I already install both of attr and attrs package. But not solving issue.

Asking for confirmation before deleting the artifact

Expected Behavior

When running kb delete --id some_id, It should ask for confirmation before deleting the artifact

Actual Behavior

It deletes the artifact right away

Specifications

  • Version: 0.1.6
  • Platform: Ubuntu 20.04

I think we should allow an option to specify if we want confirmation before deleting the artifact, since sometime accidently deleting an artifact can have a wreak havoc effect.

Error when deleting by title from command line

Expected Behavior

The artefact should have been deleted

Actual Behavior

Traceback (most recent call last):
File "/usr/local/bin/kb", line 33, in
sys.exit(load_entry_point('kb-manager', 'console_scripts', 'kb')())
File "/Users/shaptona/MyProjects/kb/kb/main.py", line 62, in main
dispatch(cmd, cmd_params, config=DEFAULT_CONFIG)
File "/Users/shaptona/MyProjects/kb/kb/main.py", line 54, in dispatch
return COMMANDS[function](*args, **kwargs)
File "/Users/shaptona/MyProjects/kb/kb/commands/delete.py", line 50, in delete
print("Artifact {id} removed!".format(args["id"]))
KeyError: 'id'

Steps to Reproduce the Problem

  1. kb delete -t <title>

Specifications

  • Version: 0.1.5
  • Platform:MacOS
  • Subsystem:

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xc4 in position 10: invalid continuation byte

Expected Behavior

trying to open pdf

Actual Behavior

Traceback (most recent call last):
File "/usr/local/bin/kb", line 33, in
sys.exit(load_entry_point('kb==0.1.1', 'console_scripts', 'kb')())
File "/usr/local/lib/python3.8/site-packages/kb-0.1.1-py3.8.egg/kb/main.py", line 62, in main
dispatch(cmd, cmd_params, config=DEFAULT_CONFIG)
File "/usr/local/lib/python3.8/site-packages/kb-0.1.1-py3.8.egg/kb/main.py", line 52, in dispatch
return COMMANDS[function](*args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/kb-0.1.1-py3.8.egg/kb/commands/view.py", line 78, in view
viewer.view(artifact_path, markers, color=color_mode)
File "/usr/local/lib/python3.8/site-packages/kb-0.1.1-py3.8.egg/kb/viewer.py", line 115, in view
content = fname.read()
File "/usr/local/Cellar/[email protected]/3.8.5/Frameworks/Python.framework/Versions/3.8/lib/python3.8/codecs.py", line 322, in decode
(result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xc4 in position 10: invalid continuation byte

Steps to Reproduce the Problem

1.kb add /Users/spencer/Code/pass/throwaway.pdf --title throwAway-Quote --category Project --tags "throwaway"
1.kbv 0
1.UnicodeDecodeError: 'utf-8' codec can't decode byte 0xc4 in position 10: invalid continuation byte

Specifications

  • Version: kb 0.1.0
  • Platform: Mac OS
  • Subsystem:

Create a new knowledge base

Expected Behavior

I believe that a function like kb --init would be advantageous to create a new knowledgeable, when someone who wishes to erase a knowledgeable and create a new one from scratch

ModuleNotFoundError: No module named '_sqlite3'

Actual Behavior

$ kb list
Traceback (most recent call last):
  File "/home/dave/.local/bin/kb", line 5, in <module>
    from kb.main import main
  File "/home/dave/.local/lib/python3.7/site-packages/kb/main.py", line 19, in <module>
    from kb.commands.add import add
  File "/home/dave/.local/lib/python3.7/site-packages/kb/commands/add.py", line 19, in <module>
    import kb.db as db
  File "/home/dave/.local/lib/python3.7/site-packages/kb/db.py", line 16, in <module>
    import sqlite3
  File "/usr/pkg/lib/python3.7/sqlite3/__init__.py", line 23, in <module>
    from sqlite3.dbapi2 import *
  File "/usr/pkg/lib/python3.7/sqlite3/dbapi2.py", line 27, in <module>
    from _sqlite3 import *
ModuleNotFoundError: No module named '_sqlite3'

Steps to Reproduce the Problem

  1. Install using pip install -U kb-management
  2. Run kb list

Specifications

  • Version: python 3.7
  • Platform: NetBSD

FYI

I did get this notice when installing, but I fixed my path.

Using legacy 'setup.py install' for attr, since package 'wheel' is not installed.
Using legacy 'setup.py install' for colored, since package 'wheel' is not installed.
Installing collected packages: attr, colored, attrs, toml, kb-manager
    Running setup.py install for attr ... done
    Running setup.py install for colored ... done
  WARNING: The script kb is installed in '/home/dave/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-lo
Successfully installed attr-0.3.1 attrs-20.3.0 colored-1.4.2 kb-manager-0.1.5 toml-0.10.2

[request] Interactive mode with FZF integration would be sweet

Hi there. I've been using kb for a while now and I love it. But I recently tried to use it with fzf and bat and I was unsucessful. I simply tried calling a shell function like:

k() { kb list | fzf --preview 'bat {}' | kb view "$@" }

or

k() { kb list | fzf --preview 'kb view "$@" | bat -p {}' }

or something to that effect.

I'm a bit of a novice so I really dont know if it'll work without patching kb itself.

Do you think this might be possible to create an interactive kb function?

Possible README error

Expected Behavior

kb Add launches editor

Actual Behavior

kb add fails to find editor

Steps to Reproduce the Problem

1.follow instructions to install for windows powershell
$env:EDITOR="C:\path\to\editor\here.exe"
[System.Environment]::SetEnvironmentVariable('EDITOR','"C:\path\to\editor\here.exe"', [System.EnvironmentVariableTarget]::User)

This appears to be missing the ' on the first line
I could not make it work until I added single quotes
$env:EDITOR='"C:\path\to\editor\here.exe"'

I am using notepad++ installed to C:Program Files\Notepad++

Specifications

  • Version:1.6
  • Platform:Windows
  • Subsystem:

Some points about the experimental git integration

I recently discovered this tool and thought it could be an idea to get rid of my various text files :D Well, I'll see how it will work out.
While tinkering with the tool I tried the experimental sync feature via git. And noticed some points (didn't look at the source yet, so maybe my observations are wrong)

  1. branch name main seems to be hardcoded? Causes issues with pushing, if git still creates master or whatever as the main branch as default
  2. every kb sync push creates a commit

regarding 1.:
Remote (and local, but that I discovered later) repo had a different branchname, which caused the following error:

Create a remote empty repository on github/gitlab or other git provider...
Insert the URL of the created empty remote repo (e.g., https://github/user/mykb): Clio:Backup/Repository/kb.git
Initialization with remote may take time...
Please provide remote credentials and wait...
Traceback (most recent call last):
  File "/usr/bin/kb", line 33, in <module>
    sys.exit(load_entry_point('kb-manager==0.1.6', 'console_scripts', 'kb')())
  File "/usr/lib/python3.9/site-packages/kb/main.py", line 66, in main
    dispatch(cmd, cmd_params, config=DEFAULT_CONFIG)
  File "/usr/lib/python3.9/site-packages/kb/main.py", line 56, in dispatch
    return COMMANDS[function](*args, **kwargs)
  File "/usr/lib/python3.9/site-packages/kb/commands/sync.py", line 46, in sync
    git_init(config["PATH_KB"])
  File "/usr/lib/python3.9/site-packages/kb/commands/sync.py", line 126, in git_init
    remote.push(refspec='{}:{}'.format("main", "main"))
  File "/usr/lib/python3.9/site-packages/git/remote.py", line 848, in push
    return self._get_push_info(proc, progress)
  File "/usr/lib/python3.9/site-packages/git/remote.py", line 735, in _get_push_info
    proc.wait(stderr=stderr_text)
  File "/usr/lib/python3.9/site-packages/git/cmd.py", line 408, in wait
    raise GitCommandError(self.args, status, errstr)
git.exc.GitCommandError: Cmd('git') failed due to: exit code(1)
  cmdline: git push --porcelain origin main:main
  stderr: 'error: src refspec main does not match any
error: failed to push some refs to 'Clio:Backup/Repository/kb.git''

After changing it on the remote if failed again. Because the local repo also had a different branchname from what the program assumed/expected:

~ $ kb sync push
zsh: correct 'sync' to 'Sync' [nyae]? n
Some error occured while pushing the code
Check your internet connection or the existence of the remote repository 

regarding 2.: It shouldn't create a commit which then gets pushed, if there is no change in the local repo.
Additional thought about this: When should the commit be created? Either after every add, edit or whatever operation changes the local state in the repo. Or stay with the current implementation. Personally I like the first. Which I luckily can do even if you don't want to change the behaviour, which would be perfectly fine.

Add homebrew support

Loosely related to #15.

I've created Homebrew tap with kb formula. I'd be happy to transfer this file (or even repo since there's only kb.rb there now) to you if you want. For now, with no pip package, it takes package from a repo.

Repo url: https://github.com/kgadek/homebrew-tools

Installation procedure using repo (tested on macOS):

brew tap kgadek/tools
brew install kgadek/tools/kb

Note: I'm definitely not an expert in Homebrew. It seems to work but definitely could get improvements. E.g. it doesn't pass brew audit ("1: col 1: Missing frozen string literal comment").

[Bug] Program fails to gracefully handle non-existent path for new artifact

Expected Behavior

Printed error describing that the path indicated by the command doesn't exist.

Actual Behavior

Stack trace because shutil can't open a write handle to the file.

Steps to Reproduce the Problem

  1. After installing kb normally via pip and activating the aliases, run kba /doesnt/exist/path

Specifications

  • Version: 0.1.4
  • Platform: Linux
  • Subsystem: ?

Distributed API to use kb (kb as a service)

I see that in the TODO list, there is kb as a service.

I'm in the middle of developing a very basic REST API which could suffice.

If you're interested in allowing me to continue this until a first Proof of Concept version works, then we can discuss if it is the correct direction ?

Great product, and great code too ! Thanks

AttributeError: module 'attr' has no attribute 's'

I install all requirements and try this cmd in first,
then google error and make

$ pip uninstall attr
$ pip install attrs

didn't work for me

kb list -v
Traceback (most recent call last):
  File "/usr/local/bin/kb", line 11, in <module>
    load_entry_point('kb==0.1.1', 'console_scripts', 'kb')()
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 490, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2859, in load_entry_point
    return ep.load()
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2450, in load
    return self.resolve()
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2456, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/usr/local/lib/python3.8/dist-packages/kb-0.1.1-py3.8.egg/kb/main.py", line 19, in <module>
    from kb.commands.add import add
  File "/usr/local/lib/python3.8/dist-packages/kb-0.1.1-py3.8.egg/kb/commands/add.py", line 19, in <module>
    import kb.db as db
  File "/usr/local/lib/python3.8/dist-packages/kb-0.1.1-py3.8.egg/kb/db.py", line 21, in <module>
    from kb.entities.artifact import Artifact
  File "/usr/local/lib/python3.8/dist-packages/kb-0.1.1-py3.8.egg/kb/entities/artifact.py", line 18, in <module>
    @attr.s(auto_attribs=True, frozen=True, slots=True)
AttributeError: module 'attr' has no attribute 's'

Specifications

  • Platform: Linux parrot 5.7.0-2parrot2-amd64 #1 SMP Debian 5.7.10-1parrot2 (2020-07-31) x86_64 GNU/Linux

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.