Creating a new category

The whole idea of a category in hlg is to classify content by subject. If you feel that you need to group your bookmarks in terms of the subject-matter, you are advised to create a new category that addresses that subject.

There are two ways to create a new category in the hlg bookmarks database:

Explicit Category Creation

An explicit category creation is when you decide to create a category and then call hlg passing the --new-category option along with the name of the category you want to create. The action taken by the user is deliberate, and not accidental.

To create a new category explicitly, simply call hlg with the --new-category option along with the name of the category to be created.

For example,

hlg --new-category books

or its short option:

hlg -n books

will create a new category called, "books" inside your bookmarks directory.

You can then add any bookmarks that have got to do with books in the newly-created category “books”

Trying to create a category which already exists will cause hlg to complain and advise you to use the existing category instead.

Implicit category creation

By default, all new categories have to be created explicitly. However, you can set hlg to create new categories implicitly by setting the “create-missing-category” option to “yes” in the configuration file.

Implicit category creation takes place in the following situations:

  • When you attempt to perform an action on a nonexistent category, hlg will silently create that category and then perform the requested action;

  • Thus, Typing this command:

    hlg geo.nasa

    will cause hlg to do the following: Look for the category called, “geo” Failing to find it, it will simply create the new category and populate it with the new bookmarks it uses for the default category; Then it tries to look for the “nasa” bookmark in that new category; Failing to find that bookmark, it will then complain of having no entry called “nasa” in the “geo” category.

This results in you having a new category called, “geo” which you can use.

The advantage with implicit category creation is that you do not need to call the --new-category option to create new categories. Simply typing a category name results in its creation if it does not exist.

The setback with implicit category creation is that a typo, or even using a wrong case, for an existing category results in the creation of a new category.

This may cause confusion if you are sure that a bookmark indeed exists in the say, “electronics” category, but hlg says it is not in the “Electronics” category!

Another effect is to have hlg create many categories that you may forget about in the long-run. So your database may end up having many categories that differ only in case, one character or even whole names!

So the default setting is to disable the “create-missing-category” option in the configuration file. If you do not mind, you can simply change it to “yes”, but be warned!