canvaslms-cli 1.4.2 → 1.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +60 -134
- package/commands/submit.js +484 -245
- package/lib/interactive.js +416 -316
- package/package.json +3 -3
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -1,182 +1,106 @@
|
|
|
1
1
|
# Canvas CLI Tool
|
|
2
2
|
|
|
3
|
-
A
|
|
3
|
+
A modern, user-friendly command-line interface for Canvas LMS. Manage courses, assignments, submissions, grades, and more directly from your terminal.
|
|
4
|
+
|
|
5
|
+
---
|
|
4
6
|
|
|
5
7
|
## Features
|
|
6
8
|
|
|
7
|
-
-
|
|
8
|
-
-
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
-
|
|
12
|
-
-
|
|
9
|
+
- List and filter enrolled/starred courses
|
|
10
|
+
- View assignments, grades, and submission status
|
|
11
|
+
- Interactive file upload for assignments
|
|
12
|
+
- View course announcements
|
|
13
|
+
- Display user profile information
|
|
14
|
+
- Direct access to Canvas API endpoints
|
|
15
|
+
|
|
16
|
+
---
|
|
13
17
|
|
|
14
18
|
## Installation
|
|
15
19
|
|
|
16
|
-
### Global
|
|
20
|
+
### Global (Recommended)
|
|
17
21
|
|
|
18
22
|
```bash
|
|
19
23
|
npm install -g canvas-cli-tool
|
|
20
24
|
```
|
|
21
25
|
|
|
22
|
-
### Local
|
|
26
|
+
### Local (Project)
|
|
23
27
|
|
|
24
28
|
```bash
|
|
25
29
|
npm install canvas-cli-tool
|
|
26
30
|
```
|
|
27
31
|
|
|
32
|
+
---
|
|
33
|
+
|
|
28
34
|
## Setup
|
|
29
35
|
|
|
30
|
-
1. **Get your Canvas API
|
|
31
|
-
- Log
|
|
36
|
+
1. **Get your Canvas API Token**
|
|
37
|
+
- Log in to Canvas
|
|
32
38
|
- Go to Account → Settings
|
|
33
|
-
-
|
|
34
|
-
- Click "+ New Access Token"
|
|
39
|
+
- Under Approved Integrations, click + New Access Token
|
|
35
40
|
- Copy the generated token
|
|
36
41
|
|
|
37
|
-
2. **Configure the CLI
|
|
42
|
+
2. **Configure the CLI**
|
|
43
|
+
|
|
38
44
|
```bash
|
|
39
45
|
canvas config
|
|
40
46
|
```
|
|
41
47
|
|
|
42
|
-
3. **
|
|
48
|
+
3. **Environment Variables**
|
|
49
|
+
|
|
50
|
+
Create a `.env` file in your project root:
|
|
51
|
+
|
|
43
52
|
```env
|
|
44
53
|
CANVAS_DOMAIN=your-canvas-domain.instructure.com
|
|
45
54
|
CANVAS_API_TOKEN=your-api-token
|
|
46
55
|
```
|
|
47
56
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
### Basic Commands
|
|
51
|
-
|
|
52
|
-
```bash
|
|
53
|
-
# Show configuration help
|
|
54
|
-
canvas config
|
|
55
|
-
|
|
56
|
-
# List starred courses (default)
|
|
57
|
-
canvas list
|
|
58
|
-
|
|
59
|
-
# List all enrolled courses
|
|
60
|
-
canvas list -a
|
|
61
|
-
|
|
62
|
-
# List courses with detailed information
|
|
63
|
-
canvas list -v
|
|
64
|
-
|
|
65
|
-
# Show user profile
|
|
66
|
-
canvas profile
|
|
67
|
-
|
|
68
|
-
# Show detailed profile information
|
|
69
|
-
canvas profile -v
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
### Assignment Operations
|
|
73
|
-
|
|
74
|
-
```bash
|
|
75
|
-
# List assignments for a course
|
|
76
|
-
canvas assignments 12345
|
|
77
|
-
|
|
78
|
-
# Show detailed assignment information
|
|
79
|
-
canvas assignments 12345 -v
|
|
57
|
+
---
|
|
80
58
|
|
|
81
|
-
|
|
82
|
-
canvas assignments 12345 -s
|
|
83
|
-
|
|
84
|
-
# Show only pending assignments
|
|
85
|
-
canvas assignments 12345 -p
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
### File Submission
|
|
89
|
-
|
|
90
|
-
```bash
|
|
91
|
-
# Interactive assignment submission
|
|
92
|
-
canvas submit
|
|
93
|
-
|
|
94
|
-
# Submit with specific course ID
|
|
95
|
-
canvas submit -c 12345
|
|
96
|
-
|
|
97
|
-
# Submit with specific assignment ID
|
|
98
|
-
canvas submit -a 67890
|
|
99
|
-
|
|
100
|
-
# Submit specific file
|
|
101
|
-
canvas submit -f myfile.pdf
|
|
102
|
-
```
|
|
59
|
+
## Usage
|
|
103
60
|
|
|
104
|
-
###
|
|
61
|
+
### Common Commands
|
|
105
62
|
|
|
106
63
|
```bash
|
|
107
|
-
#
|
|
108
|
-
canvas
|
|
109
|
-
|
|
110
|
-
#
|
|
111
|
-
canvas grades
|
|
112
|
-
|
|
113
|
-
# Show
|
|
114
|
-
canvas
|
|
115
|
-
|
|
116
|
-
# Show announcements for specific course
|
|
117
|
-
canvas announcements 12345
|
|
64
|
+
canvas config # Configure domain and API token
|
|
65
|
+
canvas list # List starred courses
|
|
66
|
+
canvas list -a # List all enrolled courses
|
|
67
|
+
canvas assignments <course> # List assignments for a course
|
|
68
|
+
canvas grades # Show grades for all courses
|
|
69
|
+
canvas announcements # Show recent announcements
|
|
70
|
+
canvas profile # Show user profile
|
|
71
|
+
canvas submit # Interactive assignment submission
|
|
118
72
|
```
|
|
119
73
|
|
|
120
|
-
###
|
|
74
|
+
### Assignment Submission
|
|
121
75
|
|
|
122
76
|
```bash
|
|
123
|
-
#
|
|
124
|
-
canvas
|
|
125
|
-
|
|
126
|
-
#
|
|
127
|
-
canvas get courses -q enrollment_state=active
|
|
128
|
-
|
|
129
|
-
# POST request with data
|
|
130
|
-
canvas post courses/123/assignments -d '{"assignment": {"name": "Test"}}'
|
|
131
|
-
|
|
132
|
-
# POST with data from file
|
|
133
|
-
canvas post courses/123/assignments -d @assignment.json
|
|
77
|
+
canvas submit # Interactive mode
|
|
78
|
+
canvas submit -c <courseId> # Specify course
|
|
79
|
+
canvas submit -a <assignmentId> # Specify assignment
|
|
80
|
+
canvas submit -f <file> # Submit specific file
|
|
134
81
|
```
|
|
135
82
|
|
|
136
83
|
## Command Reference
|
|
137
84
|
|
|
138
|
-
| Command
|
|
139
|
-
|
|
140
|
-
| `list`
|
|
141
|
-
| `assignments`
|
|
142
|
-
| `submit`
|
|
143
|
-
| `grades`
|
|
144
|
-
| `announcements` | `announce
|
|
145
|
-
| `profile`
|
|
146
|
-
| `config`
|
|
147
|
-
| `get` | `g` | GET API request |
|
|
148
|
-
| `post` | `p` | POST API request |
|
|
149
|
-
| `put` | - | PUT API request |
|
|
150
|
-
| `delete` | `d` | DELETE API request |
|
|
151
|
-
|
|
152
|
-
## File Structure
|
|
85
|
+
| Command | Alias | Description |
|
|
86
|
+
|-----------------|-----------|-----------------------------------|
|
|
87
|
+
| `list` | `l` | List courses |
|
|
88
|
+
| `assignments` | `assign` | List assignments |
|
|
89
|
+
| `submit` | `sub` | Submit assignment files |
|
|
90
|
+
| `grades` | `grade` | Show grades |
|
|
91
|
+
| `announcements` | `announce`| Show announcements |
|
|
92
|
+
| `profile` | `me` | Show user profile |
|
|
93
|
+
| `config` | - | Show configuration |
|
|
153
94
|
|
|
154
|
-
|
|
155
|
-
canvas-cli-tool/
|
|
156
|
-
├── src/
|
|
157
|
-
│ └── index.js # Main CLI entry point
|
|
158
|
-
├── lib/
|
|
159
|
-
│ ├── api-client.js # Canvas API client
|
|
160
|
-
│ ├── config.js # Configuration management
|
|
161
|
-
│ ├── file-upload.js # File upload utilities
|
|
162
|
-
│ └── interactive.js # Interactive prompt utilities
|
|
163
|
-
├── commands/
|
|
164
|
-
│ ├── list.js # List courses command
|
|
165
|
-
│ ├── assignments.js # Assignments command
|
|
166
|
-
│ ├── submit.js # Submit command
|
|
167
|
-
│ ├── grades.js # Grades command
|
|
168
|
-
│ ├── announcements.js # Announcements command
|
|
169
|
-
│ ├── profile.js # Profile command
|
|
170
|
-
│ ├── config.js # Config command
|
|
171
|
-
│ └── api.js # Raw API commands
|
|
172
|
-
└── package.json
|
|
173
|
-
```
|
|
95
|
+
---
|
|
174
96
|
|
|
175
97
|
## Requirements
|
|
176
98
|
|
|
177
|
-
- Node.js >= 14.
|
|
178
|
-
- npm >= 6.
|
|
179
|
-
- Valid Canvas LMS
|
|
99
|
+
- Node.js >= 14.x
|
|
100
|
+
- npm >= 6.x
|
|
101
|
+
- Valid Canvas LMS API token
|
|
102
|
+
|
|
103
|
+
---
|
|
180
104
|
|
|
181
105
|
## Contributing
|
|
182
106
|
|
|
@@ -184,10 +108,12 @@ canvas-cli-tool/
|
|
|
184
108
|
2. Create a feature branch: `git checkout -b feature-name`
|
|
185
109
|
3. Make your changes
|
|
186
110
|
4. Run tests: `npm test`
|
|
187
|
-
5. Commit
|
|
188
|
-
6. Push
|
|
111
|
+
5. Commit: `git commit -am 'Add feature'`
|
|
112
|
+
6. Push: `git push origin feature-name`
|
|
189
113
|
7. Submit a pull request
|
|
190
114
|
|
|
115
|
+
---
|
|
116
|
+
|
|
191
117
|
## License
|
|
192
118
|
|
|
193
|
-
MIT License - see [LICENSE](LICENSE)
|
|
119
|
+
MIT License - see [LICENSE](LICENSE) for details.
|