canvaslms-cli 1.3.1 → 1.3.3

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.
@@ -46,8 +46,15 @@ async function submitAssignment(options) {
46
46
  const starIcon = course.is_favorite ? '⭐ ' : '';
47
47
  console.log(`${index + 1}. ${starIcon}${course.name}`);
48
48
  });
49
+ const courseChoice = await askQuestion(rl, '\nEnter course number: ');
50
+
51
+ // Handle empty input
52
+ if (!courseChoice.trim()) {
53
+ console.log('No course selected. Exiting...');
54
+ rl.close();
55
+ return;
56
+ }
49
57
 
50
- const courseChoice = await askQuestion(rl, '\nEnter course number: ');
51
58
  const courseIndex = parseInt(courseChoice) - 1;
52
59
 
53
60
  if (courseIndex < 0 || courseIndex >= starredCourses.length) {
@@ -123,14 +130,22 @@ async function submitAssignment(options) {
123
130
  } else if (assignment.points_possible) {
124
131
  gradeDisplay = ` | Grade: –/${assignment.points_possible}`;
125
132
  }
126
-
127
- console.log(`${index + 1}. ${submissionIcon} ${assignment.name} ${submitted}`);
133
+ console.log(`${index + 1}. ${submissionIcon} ${assignment.name} ${submitted}`);
128
134
  console.log(` Due: ${dueDate} | Points: ${assignment.points_possible || 'N/A'}${gradeDisplay}`);
129
135
  if (!canSubmitFiles) {
130
136
  console.log(` 📋 Note: This assignment doesn't accept file uploads`);
131
137
  }
132
138
  });
133
- const assignmentIndex = parseInt(assignmentChoice) - 1;
139
+ const assignmentChoice = await askQuestion(rl, '\nEnter assignment number: ');
140
+
141
+ // Handle empty input
142
+ if (!assignmentChoice.trim()) {
143
+ console.log('No assignment selected. Exiting...');
144
+ rl.close();
145
+ return;
146
+ }
147
+
148
+ const assignmentIndex = parseInt(assignmentChoice) - 1;
134
149
 
135
150
  if (assignmentIndex < 0 || assignmentIndex >= assignments.length) {
136
151
  console.log('Invalid assignment selection.');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "canvaslms-cli",
3
- "version": "1.3.1",
3
+ "version": "1.3.3",
4
4
  "description": "A command line tool for interacting with Canvas LMS API",
5
5
  "keywords": [
6
6
  "canvas",
package/src/index.js CHANGED
@@ -26,7 +26,7 @@ const program = new Command();
26
26
  program
27
27
  .name('canvas')
28
28
  .description('Canvas API Command Line Tool')
29
- .version('1.2.0');
29
+ .version('1.3.3');
30
30
 
31
31
  // Raw API commands
32
32
  function createQueryCommand(method) {