[PR #2907] [MERGED] refactor: cli updates #4133

Closed
opened 2026-03-17 01:41:48 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/hoppscotch/hoppscotch/pull/2907
Author: @aitchnyu
Created: 1/25/2023
Status: Merged
Merged: 2/7/2023
Merged by: @AndrewBastin

Base: mainHead: cli-updates


📝 Commits (7)

  • 4d6c28c chore: move test command from functional to imperative
  • e8e21fd Merge branch 'main' of github.com:aitchnyu/hoppscotch into cli-updates
  • d306f23 Merge branch 'hoppscotch:main' into cli-updates
  • e94fb04 refactor: comments
  • 1b44f3c chore: additional readability spaces
  • 1a0a225 refactor: use instead of
  • e731525 chore: bump cli version to 0.3.1

📊 Changes

13 files changed (+137 additions, -271 deletions)

View changed files

📝 packages/hoppscotch-cli/package.json (+1 -1)
📝 packages/hoppscotch-cli/src/__tests__/commands/test.spec.ts (+32 -22)
packages/hoppscotch-cli/src/__tests__/functions/checks/checkFile.spec.ts (+0 -28)
📝 packages/hoppscotch-cli/src/__tests__/functions/collection/collectionsRunner.spec.ts (+4 -4)
📝 packages/hoppscotch-cli/src/__tests__/functions/mutators/parseCollectionData.spec.ts (+9 -11)
📝 packages/hoppscotch-cli/src/commands/test.ts (+16 -13)
📝 packages/hoppscotch-cli/src/handlers/error.ts (+3 -4)
📝 packages/hoppscotch-cli/src/options/test/delay.ts (+13 -19)
📝 packages/hoppscotch-cli/src/options/test/env.ts (+18 -55)
📝 packages/hoppscotch-cli/src/types/commands.ts (+3 -3)
📝 packages/hoppscotch-cli/src/utils/checks.ts (+1 -63)
📝 packages/hoppscotch-cli/src/utils/collections.ts (+4 -5)
📝 packages/hoppscotch-cli/src/utils/mutators.ts (+33 -43)

📄 Description

Description

Refactoring hopp cli. The cli has one command hopp test [-d delay in seconds] [-e environment key values] collectionfile.json. The old code was fp-ts heavy, returning Eithers and code was composed of pipes. I replaced the functions of Either<error, result> signature to return result in the happy path or throw error otherwise. The command handler test either prints the result or prints specific error messages.

Error messages are printed to stderr intead of stdout.

Test cases are updated to reflect new code.

Checks

  • My pull request adheres to the code style of this project
  • My code requires changes to the documentation
  • I have updated the documentation as required
  • All the tests have passed

Additional Information


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/hoppscotch/hoppscotch/pull/2907 **Author:** [@aitchnyu](https://github.com/aitchnyu) **Created:** 1/25/2023 **Status:** ✅ Merged **Merged:** 2/7/2023 **Merged by:** [@AndrewBastin](https://github.com/AndrewBastin) **Base:** `main` ← **Head:** `cli-updates` --- ### 📝 Commits (7) - [`4d6c28c`](https://github.com/hoppscotch/hoppscotch/commit/4d6c28c56db9765d0fe98260d256669e1a03ffda) chore: move test command from functional to imperative - [`e8e21fd`](https://github.com/hoppscotch/hoppscotch/commit/e8e21fdbec77802821c25905af2f827596cf1377) Merge branch 'main' of github.com:aitchnyu/hoppscotch into cli-updates - [`d306f23`](https://github.com/hoppscotch/hoppscotch/commit/d306f23d4b3af0f9b503c103bc0c8f76adebe856) Merge branch 'hoppscotch:main' into cli-updates - [`e94fb04`](https://github.com/hoppscotch/hoppscotch/commit/e94fb04215071caf6ab5b1910d6df0a6a63294a1) refactor: comments - [`1b44f3c`](https://github.com/hoppscotch/hoppscotch/commit/1b44f3c3ca7c095973b97604aba9c0b6758c5453) chore: additional readability spaces - [`1a0a225`](https://github.com/hoppscotch/hoppscotch/commit/1a0a225991d5bde11ecf194eef0ccf07888263ca) refactor: use instead of - [`e731525`](https://github.com/hoppscotch/hoppscotch/commit/e7315252d16ac6a71284db06f132a6b93aa585d4) chore: bump cli version to 0.3.1 ### 📊 Changes **13 files changed** (+137 additions, -271 deletions) <details> <summary>View changed files</summary> 📝 `packages/hoppscotch-cli/package.json` (+1 -1) 📝 `packages/hoppscotch-cli/src/__tests__/commands/test.spec.ts` (+32 -22) ➖ `packages/hoppscotch-cli/src/__tests__/functions/checks/checkFile.spec.ts` (+0 -28) 📝 `packages/hoppscotch-cli/src/__tests__/functions/collection/collectionsRunner.spec.ts` (+4 -4) 📝 `packages/hoppscotch-cli/src/__tests__/functions/mutators/parseCollectionData.spec.ts` (+9 -11) 📝 `packages/hoppscotch-cli/src/commands/test.ts` (+16 -13) 📝 `packages/hoppscotch-cli/src/handlers/error.ts` (+3 -4) 📝 `packages/hoppscotch-cli/src/options/test/delay.ts` (+13 -19) 📝 `packages/hoppscotch-cli/src/options/test/env.ts` (+18 -55) 📝 `packages/hoppscotch-cli/src/types/commands.ts` (+3 -3) 📝 `packages/hoppscotch-cli/src/utils/checks.ts` (+1 -63) 📝 `packages/hoppscotch-cli/src/utils/collections.ts` (+4 -5) 📝 `packages/hoppscotch-cli/src/utils/mutators.ts` (+33 -43) </details> ### 📄 Description ### Description <!-- Add a brief description of the pull request --> Refactoring `hopp` cli. The cli has one command `hopp test [-d delay in seconds] [-e environment key values] collectionfile.json`. The old code was fp-ts heavy, returning `Either`s and code was composed of pipes. I replaced the functions of `Either<error, result>` signature to return `result` in the happy path or throw `error` otherwise. The command handler `test` either prints the result or prints specific error messages. Error messages are printed to stderr intead of stdout. Test cases are updated to reflect new code. <!-- You can also choose to add a list of changes and if they have been completed or not by using the markdown to-do list syntax - [ ] Not Completed - [x] Completed --> ### Checks <!-- Make sure your pull request passes the CI checks and do check the following fields as needed - --> - [x] My pull request adheres to the code style of this project - [ ] My code requires changes to the documentation - [ ] I have updated the documentation as required - [x] All the tests have passed ### Additional Information <!-- Any additional information like breaking changes, dependencies added, screenshots, comparisons between new and old behaviour, etc. --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-17 01:41:48 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/hoppscotch#4133
No description provided.