npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

materials-cli

v1.2.2

Published

CLI for Imperial Materials

Downloads

10

Readme

Materials CLI

npm NPM

CLI for Imperial's Department of Computing Materials Page.

Pulls all the latest resources from your course into your folder, pulling only the ones you haven't got in your folder.

Credentials are stored using keytar:

On macOS the passwords are managed by the Keychain, on Linux they are managed by the Secret Service API/libsecret, and on Windows they are managed by Credential Vault.

Features

  1. Auto download resources for courses from terminal
  2. Auto login (after first call) to quickly access resources
  3. Only pulls new resources, so you don't need to find which ones are new
  4. Shortcuts to quickly access your main courses
  5. Concurrent downloads of materials

CLI demo

Installation

Prerequisites (Only Linux)

Ubuntu

sudo apt-get install libsecret-1-dev gnome-keyring

Other Linux Distributions

Please check the documentation for keytar to download them

Package Installation

npm install -g materials-cli

Usage

Type materials in the terminal to access the CLI.

Full options:

usage: materials [-h] [-v] [-c] [-d] [-a] [shortcut]

Materials CLI Tool

positional arguments:
  shortcut       Shortcut to course

optional arguments:
  -h, --help     show this help message and exit
  -v, --version  show program's version number and exit
  -c, --clean    Clean configurations
  -o, --open     Open folder based off shortcut or selection
  -d, --dir      Save folders in current directory instead
  -a, --all      Download all shortcut courses one go

Shortcuts

You can set shortcuts to courses by using the shortcut argument. If no shortcut is found, selecting the course will assign
the shortcut to the chosen course. The next time you run materials it will automatically fetch courses for the course chosen before.

Example:

Using CV shortcut for first time:

Shortcut Example 1

Using CV example again:

Shortcut Example 2

You can use -a or --all to download all the courses that have shortcuts in one go

Credentials

Credentials are stored in the OS's keychain and retrieved on every call to materials.

The credentials are never sent to anywhere other than https://materials.doc.ic.ac.uk and https://api-materials.doc.ic.ac.uk.

The package keytar is used for this.

TODO

Currently, this uses a mix of the current materials page (https://materials.doc.ic.ac.uk) and the new API (https://api-materials.doc.ic.ac.uk).

The new API is slow to fetch resources, and the /file endpoint doesn't seem to work so that's why the old version is used for file fetching.

When the new API is ready to serve files, the legacy method should be removed.

  1. Remove old API method using session cookies
  2. Add fine-grained control of config of credentials and shortcuts
  3. Find way to schedule pulling of files in the mornings
  4. Test on different Linux distributions