Working with other bookmarks in other categories

To visit any bookmark other than the one in the default category, supply the name of the category as an optional argument to hlg.

For instance, if your default category is “books”, but you wish to open a bookmark called “radio” in the “electronics” category, you can do it in any of the following three ways:

  • By passing in the --category long option like this:

    hlg --category electronics radio
  • Or by passing in the --category short option which is c like this:

    hlg -c electronics radio
  • Or simply passing in the fully-qualified name of radio like this:

    hlg electronics.radio
    • In providing a fully-qualified name, we have the category name first, followed by a period, then the bookmark name.

    • Since the period is used by hlg in this way, we can see that a period cannot be part of a category or bookmark name.

    • To separate words, instead of using periods, use either dashes like this: my-great-category or underscores like this: my_great_category

Working with categories this way makes it possible to have each category have its own home bookmark, flagged bookmark and shortcut keys. No collision will happen.

The next question could be: Well, as hlg . launches the default category home bookmark, how about opening a home bookmark of another category?

This is important as we have learnt in the home bookmarks page, that a home bookmark cannot have a shortcut key.

To launch a home bookmark of another category other than the default, you

  • Either call the hlg with the "category" option set and do not pass the bookmark name as an argument. For example, to call the home bookmark of the "electronics" category, we will do it like this:

    hlg -c electronics
  • Or we just pass the category name to hlg and attach a dangling period like this:

    hlg electronics.
  • So a period with nothing to its right-hand side means we are calling the category home bookmark.

A period viewed in this way has some interesting properties:

  • Its presence means that we are looking at a fully-qualified bookmark name;

  • A period separates a category from a bookmark:

    • To its left is the category name, and

    • To its right is the bookmark name.

    • Whenever one of the left or right hand side items is missing, then:

      • If a category is missing, then the default category is used

      • And if the bookmark name is missing, the home bookmark of the indicated category will be used.

    • Thus, .radio is just like typing radio which means that you just typed an extra keystroke for nothing! A period is always dropped if it appears as the first character in a bookmark name as this means “default-category”

    • And typing electronics. means you just passed in the category name without a bookmark, so the category home bookmark of the “electronics” category will be used.

Do not do this:

hlg --category electronics books.gutenberg

hlg will complain that your category is set in two places:

  • The first being the option --category with the “electronics” as its argument; and

  • The second being part of the fully-qualified name “books.gutenberg”

  • In the latter case, “books” is the category to launch the “gutenberg” bookmark.

This will confuse hlg such that it will simply complain and tell you to fix your command and then quit.

So remember to set your category in one place, but not in both.