Skip to content

snivilised/traverse

Repository files navigation

πŸŒ€ traverse: rx observable concurrent directory walker

A B A B A B Go Reference Go report Coverage Status Astrolib Continuous Integration pre-commit A B

go.dev

πŸ”° Introduction

This project provides a directory walker in the same vein as the Walk in standard library filepath, but provides many features in addition to the basic facility of simply navigating. These include, but not limited to the following:

  • Comprehensive filtering with regex/glob patterns
  • Resume, from a previous navigation that was prematurely terminated (typically via a ctrl-c interrupt), or cancellation via a context; this is particularly useful if the client program runs heavy IO bound tasks resulting in relatively long batch runs
  • Hibernation, this allows for client defined action to be invoked for eligible file/folders encountered during navigation, when a particular condition occurs; as opposed to invoking the client action for every file/folder from the root onwards. The navigator starts off in a hibernated state, then when the condition occurs, the navigator awakens and begins invoking the client action for eligible nodes.
  • Concurrent navigation implemented with a reactive model, using rx observables
  • Compatibility with os.fs file system
  • Ability to hook many aspects of the traversal process

πŸ“š Usage

πŸŽ€ Features

ginkgo gomega

🌐 l10n Translations

This template has been setup to support localisation. The default language is en-GB with support for en-US. There is a translation file for en-US defined as src/i18n/deploy/astrolib.active.en-US.json. This is the initial translation for en-US that should be deployed with the app.

Make sure that the go-i18n package has been installed so that it can be invoked as cli, see go-i18n for installation instructions.

To maintain localisation of the application, the user must take care to implement all steps to ensure translate-ability of all user facing messages. Whenever there is a need to add/change user facing messages including error messages, to maintain this state, the user must:

  • define template struct (xxxTemplData) in src/i18n/messages.go and corresponding Message() method. All messages are defined here in the same location, simplifying the message extraction process as all extractable strings occur at the same place. Please see go-i18n for all translation/pluralisation options and other regional sensitive content.

For more detailed workflow instructions relating to i18n, please see i18n README