Coder Social home page Coder Social logo

myges-cli's Introduction

MyGES CLI

A Command Line Interface replacement for MyGES (Réseau GES' Extranet).

How to install

You need to have npm installed.

npm i -g myges

Usage

Authenticate with myges login (only needed once).

myges help
Usage: myges [options] [command]

Options:
  -V, --version                     output the version number
  -d, --debug                       debug mode
  -h, --help                        display help for command

Commands:
  absences [options] [year]         list absences
  agenda [options] [week]           fetch agenda
  calendar-sync [days]              sync myges calendar with Google Calendar
  contribute                        show useful links
  courses [options] [year]          list courses
  grades [options] [year]           list grades
  login [options]                   sign in to an account
  logout [options]                  remove the saved auth informations
  projects                          manage projects
  request [options] <method> <url>  make a request to the API

Agenda

The agenda command is a little special since it offers diverse options in order to ease its use.

Listing weeks

You can list and select the week to display by using the -i option (alias of --interactive).

Manual week selection

It's possible to manually specify the wanted week. Here's some possibilities:

  • myges agenda 19-03-2020 -> Shows the week from last Sunday to next Sunday of the date 19-03-2020
  • myges agenda 19-03 -> Shows the week from last Sunday to next Sunday of March 19 of the current year
  • myges agenda 19 -> Shows the week from last Sunday to next Sunday of the day 19 of the current month and year
  • myges agenda today -> Displays today's agenda
  • myges agenda tomorrow -> Displays tomorrow's agenda
  • myges agenda yesterday -> Displays yesterday's agenda

A shifting can be added to the specified week:

  • myges agenda today+2 -> Shows the agenda of 2 days from today
  • myges agenda today+-2 -> Shows the agenda of 2 days ago from today

Those shifts can be applied to any manual week input using the same format (+n).

Project management

Using the CLI, you can list available projects and project groups. You can also join or quit a project group.

  • myges projects -> List available projects
  • myges project <id> -> Give information about the selected project (replace <id> by the actual group's id given in the projects list)
  • myges project <id> groups -> List available groups for the specified project
  • myges project <id> join [group] -> Join a group. You can specify the group by replacing the optional [group] argument, else it will prompt a selector
  • myges project <id> quit -> Quit the current group you're in. A confirmation will be required before executing the request

Calendar Sync

This command allows you to syncronize your calendar on goocle calendar (and thus no longer use the myges planning!).

  • myges calendar-sync <days> -> Sync google calendar from today to given number of days
  • myges calendar-sync --reset_credentials -> Reset google credentials and ask it again
  • myges calendar-sync --reset_calendar -> Reset google calendar ID and ask it again
  • You need to setup few things before using this script.

Setup Google API

To make the script work, you need to create a google calendar API and save its information like this :

image image
image
  • Save the credentials.json file, you will need information inside it at first time.

image

Create new Google Calendar

⚠️ Be sure to create a calendar dedicated ONLY to your schedule! Otherwise the script will delete the other events present in your calendar ...

To retrieve your calendar id:

  • Go to https://calendar.google.com

  • Go to "Settings and sharing" of the calendar dedicated to your planning image

  • You will find the id of your calendar in the section "Integrate the calendar" image

First launch

At the first launch, you will be asked to enter the various information that you have configured before.

If this is the first connection, follow the terminal's instructions to retrieve the google connection token

When you click on the Google url, don't forget to copy the given authorization token and paste it into the CLI

image-20211121185850513

myges-cli's People

Contributors

angristan avatar dependabot[bot] avatar nouuu avatar quantumsheep avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

myges-cli's Issues

grades: Cannot read property 'map' of undefined

➜  ~ myges grades --debug
? Choose a year 2020
TypeError: Cannot read property 'map' of undefined
    at Command.<anonymous> (/usr/local/lib/node_modules/myges/src/app.js:196:47)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)

I have a missing semester, that might be related?

image

MyGES API update

The API has been updated since tuesday and this project doesn't work anymore. I'm trying to connect programmatically too as I have a bot that has MyGES commands so if I succeed first I'll let you know.

Good luck I guess :D

Google Calendar - 400 API error

I am currently experiencing a problem with the authorization code retrieval link.
Once the JSON file is downloaded, and the "client_id" and "client_secret" data is extracted, the URL communicating the authorization code, returns the following error:
Capture d’écran 2022-04-26 à 18 13 48
The application type is properly defined as "Desktop app", but the issue still persists.

Technical env:
X86 VM + Debian Bullseye + NPM/NodeJS installed from source.
I created a new project, and defined the application as "published.

Support for "Remote" room

When displaying an agenda, there is no mentions of whether this course is given remotely or in-site (since the pandemic).

For instance, in this schedule.

Day                 Schedule               Room(s)        Name         Teacher
Tue, May 25, 2021   09:45 AM -> 11:15 AM   [Obfuscated]   [Obfuscated] [Obfuscated]
Tue, May 25, 2021   11:30 AM -> 01:00 PM   [Obfuscated]   [Obfuscated] [Obfuscated]
Tue, May 25, 2021   02:00 PM -> 03:30 PM   [Obfuscated]   [Obfuscated] [Obfuscated]
Tue, May 25, 2021   03:45 PM -> 05:15 PM   [Obfuscated]   [Obfuscated] [Obfuscated]
Tue, May 25, 2021   05:30 PM -> 07:00 PM   [Obfuscated]   [Obfuscated] [Obfuscated]

Day                 Schedule               Room(s)        Name         Teacher
Wed, May 26, 2021   09:45 AM -> 11:15 AM   [Obfuscated]   [Obfuscated] [Obfuscated]
Wed, May 26, 2021   11:30 AM -> 01:00 PM   [Obfuscated]   [Obfuscated] [Obfuscated]
Wed, May 26, 2021   02:00 PM -> 03:30 PM   [Obfuscated]   [Obfuscated] [Obfuscated]
Wed, May 26, 2021   03:45 PM -> 05:15 PM   [Obfuscated]   [Obfuscated] [Obfuscated]
Wed, May 26, 2021   05:30 PM -> 07:00 PM   [Obfuscated]   [Obfuscated] [Obfuscated]

Day                 Schedule               Room(s)        Name         Teacher
Thu, May 27, 2021   09:45 AM -> 11:15 AM                  [Obfuscated] [Obfuscated]
Thu, May 27, 2021   11:30 AM -> 01:00 PM                  [Obfuscated] [Obfuscated]
Thu, May 27, 2021   02:00 PM -> 03:30 PM                  [Obfuscated] [Obfuscated]
Thu, May 27, 2021   03:45 PM -> 05:15 PM                  [Obfuscated] [Obfuscated]

Day                 Schedule               Room(s)        Name         Teacher
Fri, May 28, 2021   08:00 AM -> 09:30 AM                  [Obfuscated] [Obfuscated]
Fri, May 28, 2021   09:45 AM -> 11:15 AM                  [Obfuscated] [Obfuscated]

The name of the courses that are held remotely should rather be "Remote" instead of an empty string since this is the behavior adopted by the MyGES website.

image

Actually, the room is empty, but this would allow for having a quick glance at, again, whether this course is held remotely or not.

Or there can be another index for the displayed array that could say Remote (Yes, No). But I feel like the agenda is wide enough and in small terminal emulators the space could be optimized by using the empty rooms.

Unecessary files in package

Issue

Some files are not ignored when packed before being pushed to NPM packages registry.

GitHub Action workflow files and sources should not be packed and take an unecessary amount of space in the tarball and when downloaded in the client's filesystem.

Reproduction steps

$ npm pack --dry-run

Additional Context

Adding the following line in the package.json file reduce the tarball size from 17.4Kb down to 9.9Kb.

{
  "files": ["dist"]
}

Also consider adding an optimization step with rollup and rollup-plugin-terser for instance to remove unecessary blank spaces in the transpiled files to save theoretically more than 50% added space in the packed tarball.

api is slow

I love your npm plugin a lot, and use it. But i have a problem with the api, the request of get calendar only show the passed event, not the full week as asked.
Can you do something about it? Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.