パッケージの詳細

goalist

jrmykolyn96ISC0.13.1

Goalist is a command line tool for managing daily goals.

goal, goals, goalist, helper

readme

Build Status Coverage Status

Goalist

Table of Contents

About

Goalist is a tool for managing daily goals. Goalist can be run directly from the command line, or imported by a dependent script.

Installation

Overview

Goalist can be installed in multiple ways depending on the use case. To interact with Goalist's CLI, follow the 'CLI' installation instructions. To use the Goalist module within a dependent script, follow the 'Import' installation instructions.

CLI

To install Goalist globally, run the command below:

npm install -g goalist

Import

To install Goalist as a dependency within a node/npm project, run the command below:

npm install --save goalist

Setup

Goalist does not require any additional configuration.

Usage

Overview

The Goalist module may used/accessed in either of the following ways:

  • via import by/within a dependent script;
  • via CLI.

Documentation for both modes is provided below.

Subcommands

Included below is an overview of all subcommands exposed by the Goalist package. See the CLI and/or Import sections below for detailed usage instructions.

Subcommand Description
add Add a new goal.
archive Archive an existing goal.
backup Create a backup of all goal data.
complete Mark an existing goal as complete.
list List all goal data.
progress Display progress data, including: total number of goals; complete goals; incomplete goals; etc.
remove Remove an existing goal.
update Update an existing goal.

CLI

When installed globally, Goalist exposes the gl command. Running gl from the command line will display the help menu. In order to interact with the core functionality of the Goalist package, a selection of subcommands are exposed. Each subcommand can be invoked using its full name (eg. add), or via a single character alias (eg. a). See below for the full list commands.

Please note:

  • The help menu can also be accessed by invoking gl with the --help flag (eg. gl --help).
  • The current version can be accessed by invoking gl with the --version flag (eg. gl --version).
  • Goalist can be run in 'silent' mode by invoking gl {{ COMMAND }} with the --silent flag (eg. gl add "My new goal." --silent). This suppresses all output.
  • Goalist can be run in 'verbose' mode by invoking gl {{ COMMAND }} with the --verbose flag (eg. gl list --verbose). This displays additional information about the internals of a given command, and may be useful for debugging purposes.

add / a

This command is used to add a new goal to the log file for the current.

gl add "This is the title of the goal."

archive / ar

This command is used to archive/deactivate a given goal.

gl archive {{ ID }}

Executing the command above will result in the following:

  • Target goal is moved from the 'active' log file to the 'archive' file.
  • Target goal will have its active key/property set to false.

When invoked with the --active flag, this command will perform the reverse operation.

gl archive {{ ID }} --active

Executing the command above will result in the following:

  • Target goal is moved from the 'archive' log file to the 'active' file.
  • Target goal will have its active key/property set to true.

backup / b

This command is used to created a backup of the 'active' log file.

gl backup

When invoked with the --archive file, an 'archive' log file backup is created instead.

gl backup --archive

complete / c

This command is used to toggle the 'complete' property for a specific goal. By default, this command operates on 'active' goals.

To mark a goal as complete, invoke the subcommand with the goal ID.

gl complete {{ ID }}

This command can also be used to set the status of a goal to 'incomplete'.

gl complete {{ ID }} --false

To toggle the 'complete' state of a goal within the 'archive' log, provide the --archive flag.

gl complete {{ ID }} --archive // Set an archived goal to complete.

gl complete {{ ID }} --archive --false // Set an archived goal to incomplete.

list / l

This command is used to list all goals present in the 'active' log file. This command is especially useful for goal IDs, which are required by the update subcommand. By default, only the ID and title for each goal will be displayed.

gl list

When invoked with the --archive flag, this command will display the contents of the 'archive' log file.

gl list --archive

To display all of the data for a given goal, invoke the list command with the --all flag/argument.

gl list --all
gl list --archive --all

To display specific properties , the list command may be invoked with the --show flag. When provided with a series of comma delimited strings, --show flag displays the corresponding properties (in addition to the ID and title).

gl list --show=title,complete

// title: My New Goal
// complete: true

progress / p

This command is used to display progress information relating to the 'active' log file (eg. total number of goals, number of completed goals, etc.).

gl progress

remove / r

This command is used to remove a specific goal within the 'active' log file.

gl remove {{ ID }}

If invoked with the --archive flag, this command will attempt to remove the target goal from the 'archive' log file.

gl remove {{ ID }} --archive

update / u

This command is used to update a specific goal within the 'active' log file.

gl update {{ ID }} --title="This is the new title of the goal."

Import

When installed locally, Goalist can be imported into a dependent script.

const Goalist = require( 'goalist' );

After Goalist has been imported, create a new instance as follows:

let goalist = new Goalist();

By default, Goalist will write to/read from a hidden .goalist folder within the the current user's home directory. This behavior can be overridden by providing an object with a key of utilsOpts at instantiation time.

let goalist = new Goalist( {
    utilsOpts: {
        path: '/path/to/custom/goalist/dir',
    },
} );

By default, Goalist does not log any information to stdout. However, this behavior can be enabled by providing an object with a key of debuggerOpts at instantiation time.

let goalist = new Goalist( {
    debuggerOpts: {
        mode: 'verbose', // Valid values are: 'verbose'; 'normal'; 'silent'.
    },
} );

Goalist exposes the #run() instance method, which is used to execute individual subcommands.

goalist.run( 'list' ); // Execute the 'list' subcommand.

#run() returns a Promise, which will resolve or reject depending on whether the operation was successful. To access the data returned by the #run() method, invoke the .then( ... ) on the value returned by #run().

goalist.run( 'list' )
    .then( ( data ) => {
        // Do something with the data returned by 'list' here.
    } )
    .catch( ( err ) => {
        // Handle potential errors here.
    } );

Some of the Goalist subcommands require additional information in order to function properly (this is generally the case if the subcommand operates on a specific goal). These can be provided by invoking the #run() command with a second argument.

goalist.run( 'complete', [ '1516126195749' ] ); // Mark the goal with id '1516126195749' as complete.

Additional options can be provided by invoking #run() with a third argument.

goalist.run( 'update', [ '1516126195749' ], { title: 'My cool new title.' } ); // Update the title property of the goal with id '1516126195749'.

For cases where the options object is required but the array of supplementary information is not, provide an empty array or null value as the second argument.

goalist.run( 'list', [], { archive: true } ); // List all of the 'archived' goals.

goalist.run( 'backup', null, { archive: true } ); // Create a backup of the 'archived' goals file.

Documentation

Currently, Goalist does not include any external documentation.

For an overview of the project's evolution, please consult the CHANGELOG.

更新履歴

Change Log

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog and this project adheres to Semantic Versioning.

[0.13.1] - 2018-01-25

Added

  • Added support for setting 'complete' state of archived goals (eg. gl complete {{ ID }} --archive).

[0.13.0] - 2018-01-23

Added

  • Added backup subcommand.
  • Added support for remove {{ ID }} --archive (eg. remove goal directly from 'archive' log file).
  • Added support for 'silent' and 'verbose' modes (eg. Debugger configuration).
  • Added support for Utils configuration via Goalist constructor.
  • Added Subcommands section to README.md.
  • Added tslint.json.
  • Added the follow development dependencies: tslint; gulp-tslint; tslint-eslint-rules.

Changed

  • Updated Goalist class definition: removed COMMAND, INPUT, and ARGS parameters; replaced with options object;
  • Updated 'import' usage: Goalist now runs in 'silent' mode by default.
  • Updated CLI entryoint logic: remove call to #preflight() method; simplify Promise chain; ensure that COMMAND is captured as a string.
  • Updated #run() instance method: validate arguments; set default values; ensure that files/folder exist or are created at invocation time.
  • Updated add command: now returns individual goal object; now rejects with an error.
  • Updated archive command: now rejects with an error.
  • Updated complete command: now returns individual goal object; now rejects with an error.
  • Updated progress command: now returns a 'progress data' object; only displays bar chart when running in non-silent CLI mode.
  • Updated remove command: now rejects with an error.
  • Updated update command: now returns individual goal object; now rejects with an error.
  • Updated Goalist tests.
  • Updated Gulp file: added typescript linting tasks.
  • Updated README.md file: added documentation for non-CLI usage.

Fixed

  • Fixed typos and incorrect documentation in README.md

Removed

  • Removed #preflight() instance method.

[0.12.0] - 2018-01-12

Added

  • Added chalk to deps.
  • Added support for list --all (display all goal properties).
  • Added support for list --show (replaces list --only).

Changed

  • Updated list command documentation.
  • Removed support for list --only.

[0.11.2] - 2018-01-11

Added

  • Added 'keywords' field to package.json.

Changed

  • Remove 'version' from 'help' menu.

[0.11.1] - 2018-01-11

Changed

  • Updated README.md.
  • Removed version command.

[0.11.0] - 2018-01-11

Changed

  • Updated input signature of Goalist constructor: from ( [ COMMAND, ARGS ] ); to ( [ COMMAND, INPUT, ARGS ] ).
  • Updated input signature of command functions: from ( ARGS, utils ); to ( INPUT, ARGS, utils ).
  • Replaced minimist with meow.
  • Removed minimist from deps.

[0.10.2] - 2018-01-10

Added

  • Added tests for 'Goalist'.

Changed

  • Fixed issue where 'main' field in package.json file pointed to CLI script.

[0.10.1] - 2018-01-09

Changed

  • Transpiled TypeScript.

[0.10.0] - 2018-01-09

Added

  • Added support for 'help' menu (accessed via --help).
  • Added meow to development dependencies.

Changed

  • Updated 'update' command to display output when 1+ properties are successfully updated.

[0.9.0] - 2018-01-05

Changed

  • Updated shape of 'goal' data: changed 'status' to 'complete'.
  • Updated Utils module: added new helper methods; built out tests.
  • Updated README.md.

[0.8.0] - 2018-01-02

Added

  • Added archive subcommand.

Changed

  • Updated shape of 'goal' data: added active property.
  • Updated structure/contents of logs/ directory: replaced 'daily' log files with 'active'/'archive' logs.
  • Updated list subcommand: added support for --archvive flag; removed feature where Identifier key/value is always logged out.
  • Updated Utils module: removed old/unused methods; refactored existing methods.
  • Updated README.md.
  • Removed old/unused tests.

[0.7.1] - 2018-01-02

Changed

  • Fixed incorrect output path in gulpfile.js: changed from ./lib to ./dist.
  • Updated TODO.md.

[0.7.0] - 2017-11-22

Added

  • Adding the following dependencies: merge;
  • Added the following development dependencies: gulp; gulp-typescript; typescript; @types/node; @types/object-assign.

Changed

  • Converted package internals to TypeScript (src/).
  • Renamed lib/ to dist/.

[0.6.1] - 2017-11-20

Added

Changed

[0.6.0] - 2017-11-03

Added

  • Built out remaining tests for Utils module.
  • Completed first pass of Debugger module.

Changed

  • Converted 'utils' and 'goalist' methods into Utils/Goalist classes.
  • Moved setup logic into 'Goalist' module.
  • Updated 'command' scripts to receive Utils module instance at invocation time.
  • Completed misc. updates to program initialization logic (ie. /index.js).

[0.5.0] - 2017-10-26

Added

  • Added ava testing framework to project. Test suite can be run by invoking npm run test or npm run test:verbose.
  • Started implementing tests for utils module.
  • New log files now include any 'incomplete' goals present within the most recent log.

Changed

  • Updated program to read/write logs from/to .goalist/logs/. Previously, each log had a corresponding directory (eh. .goalist/2017-01-01/goatlist_2017-01-01.log, etc.).
  • Various refactoring: removed getYesterday*() methods; added readLog(), etc.

[0.4.0] - 2017-10-21

Added

  • Added complete subcommand.
  • Added single character aliases for each existing subcommand.

Changed

  • Updated add subcommand: display message on success.

[0.3.0] - 2017-10-18

Added

  • Added remove subcommand.

Changed

  • Updated list subcommand to accept --only flag/argument. See README file for usage details.

[0.2.0] - 2017-10-17

Added

  • Added progress subcommand.
  • Added getYesterday*() methods to utils module.

Changed

  • Updated program to merge 'incomplete' tasks from previous day into new log file.
  • Updated add subcommand to validate presence of title.
  • Updated update subcommand to valid arguments, log errors.
  • Updated utils methods to print errors if log files cannot be read.

[0.1.0] - 2017-09-13

Added

  • Completed first pass of goalist program. Added support for the following commands: add; list; update.
  • Added README.md, CHANGELOG.md, and TODO.md files.