GithubHelp home page GithubHelp logo

mittwald / cli Goto Github PK

View Code? Open in Web Editor NEW
7.0 7.0 0.0 280.33 MB

The mittwald command-line interface

License: MIT License

JavaScript 0.17% Batchfile 0.02% TypeScript 99.37% Shell 0.14% Dockerfile 0.09% Ruby 0.21%
cli hacktoberfest

cli's People

Contributors

ayalcin-mw avatar dependabot[bot] avatar martin-helmich avatar mfal avatar niristius avatar thueske avatar tillwestpfahl avatar yannikbramkamp avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

cli's Issues

`mail deliverybox list` does not use project context

The command mw mail deliverybox list should use the project-id context instead of complaining about a missing flag project-id.

~ ❯ mw context get 

Current CLI context

--project-id   e294bb27-a208-4512-ade3-21e4b1e917c5
--server-id    not set
--org-id       65543619-a808-4787-bf1d-8b454f648fb5

╭──────────────────────────────────────────────────────────────────────────────╮
│  NOTE                                                                        │
│  Use the mw context set command to set one of the values listed above.       │
╰──────────────────────────────────────────────────────────────────────────────╯

~ ❯ mw mail deliverybox list
╭──────────────────────────────────────────────────────────────────────────────╮
│ INVALID COMMAND FLAGS                                                        │
│                                                                              │
│ The flags that you provided for this command were invalid. The following     │
│ error occurred:                                                              │
│   Missing required flag project-id                                           │
│ See more help with --help                                                    │
╰──────────────────────────────────────────────────────────────────────────────╯

Add API-Token per Project

for testing or demo issues (e.g. new customers) it would be nice to create an api-token just for one project without creating a new account

Add Lock Project

lock projects for security reason to avoid accidentally erasure
(additionally introduce project status option "active/inactive")

Error when creating projects

Executing the command:

/Users/thueske [thueske@MBP-M1-Hueske] [11:27]
> mw project create -s b54845e8-81ad-462e-983a-2f00c5e040c6 -d "Example Project" -q -w

Throws the following error:

ERROR  Text string "a2371f43-6343-4465-8a2f-469d10fd807a" must be rendered inside <Text> component

file:///opt/homebrew/Cellar/mw/1.0.0-alpha.20/libexec/node_modules/ink/build/reconciler.js:127:19

 - createTextInstance (file:///opt/homebrew/Cellar/mw/1.0.0-alpha.20/libexec/node_modules/ink/build/reconciler.js:127:19)
 - completeWork (/opt/homebrew/Cellar/mw/1.0.0-alpha.20/libexec/node_modules/react-reconciler/cjs/react-reconciler.development.js:13653:40)
 - completeUnitOfWork (/opt/homebrew/Cellar/mw/1.0.0-alpha.20/libexec/node_modules/react-reconciler/cjs/react-reconciler.development.js:18736:16)
 - performUnitOfWork (/opt/homebrew/Cellar/mw/1.0.0-alpha.20/libexec/node_modules/react-reconciler/cjs/react-reconciler.development.js:18711:5)
 - workLoopSync (/opt/homebrew/Cellar/mw/1.0.0-alpha.20/libexec/node_modules/react-reconciler/cjs/react-reconciler.development.js:18609:5)
 - renderRootSync (/opt/homebrew/Cellar/mw/1.0.0-alpha.20/libexec/node_modules/react-reconciler/cjs/react-reconciler.development.js:18577:7)
 - performSyncWorkOnRoot (/opt/homebrew/Cellar/mw/1.0.0-alpha.20/libexec/node_modules/react-reconciler/cjs/react-reconciler.development.js:18193:20)
 - flushSyncCallbacks (/opt/homebrew/Cellar/mw/1.0.0-alpha.20/libexec/node_modules/react-reconciler/cjs/react-reconciler.development.js:2936:22)
 - flushSyncCallbacksOnlyInLegacyMode (/opt/homebrew/Cellar/mw/1.0.0-alpha.20/libexec/node_modules/react-reconciler/cjs/react-reconciler.development.js:2915:5)
 - scheduleUpdateOnFiber (/opt/homebrew/Cellar/mw/1.0.0-alpha.20/libexec/node_modules/react-reconciler/cjs/react-reconciler.development.js:17646:7)

The project is nevertheless created without any problems.

`project` subcommands are inconsistent

Based on a feedback by @thueske:

Was mir jedoch noch nicht ganz klar ist und mich im ersten Moment verwirrt hat: Innerhalb mw project finde ich Cronjobs, Backups, Memberships, SFTP usw. Die Datenbanken, Domains und Mails hingegen auf oberster Ebene :thinking_face: Das hat sich mir jetzt nicht direkt erschlossen und ich würde es unter Projekt erwarten.

This is generally inconsistent, and as to not nest commands too deeply, I'd be in favour of placing the backup, ssh-user, sftp-user and cronjob commands on the top-level (next to database, domain and other project-related) commands, so that the project topic is reserved for editing the project aggregate in itself.

PR incoming.

Add link to Guthub project in Error message

The error messages include the hint to open a bug report.

Please provide this when opening a bug report.

I think it would be be useful to add a link to this Github project to save the user searching for the project.

How does filter option work?

I’m not able to figure out how the --filter option of the list commands should be used.

tried it using the command project list. I have tried every combination I was able to think about. Some examples

mw project list --filter="customerId=8b454f648fb5"
mw project list --filter "customerId=8b454f648fb5"
mw project list --filter "customerId=8b454f648fb5"
mw project list --filter="customer-id=8b454f648fb5"

Everything produce the same error:

│ ERROR                                                                        │
│                                                                              │
│ An error occurred while executing this command:                              │
│                                                                              │
│   Error: Filter flag has an invalid value                                    │
│                                                                              │

The OCLIF documentation provides this example:

$ example-cli users --filter="company=Group"

  ERROR STACK TRACE

  Please provide this when opening a bug report.

  Error: Filter flag has an invalid value
      at Table.display (/opt/homebrew/Cellar/mw/1.0.0-alpha.21/libexec/node_modules/@oclif/core/lib/cli-ux/styled/table.js:68:23)
      at Object.table (/opt/homebrew/Cellar/mw/1.0.0-alpha.21/libexec/node_modules/@oclif/core/lib/cli-ux/styled/table.js:271:39)
      at ListFormatter.log (file:///opt/homebrew/Cellar/mw/1.0.0-alpha.21/libexec/dist/esm/Formatter.js:31:12)
      at List.run (file:///opt/homebrew/Cellar/mw/1.0.0-alpha.21/libexec/dist/esm/ListBaseCommand.js:27:24)
      at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
      at async List._run (/opt/homebrew/Cellar/mw/1.0.0-alpha.21/libexec/node_modules/@oclif/core/lib/command.js:117:22)
      at async Config.runCommand (/opt/homebrew/Cellar/mw/1.0.0-alpha.21/libexec/node_modules/@oclif/core/lib/config/config.js:329:25)
      at async Object.run (/opt/homebrew/Cellar/mw/1.0.0-alpha.21/libexec/node_modules/@oclif/core/lib/main.js:89:16)

`user get` throws authentication error

Trying to execute mw user get gives the following error message

╭──────────────────────────────────────────────────────────────────────────────╮
│ API CLIENT ERROR                                                             │
│                                                                              │
│ An error occurred while communicating with the API: Unexpected response      │
│ status (expected 200, got: 403)                                              │
│                                                                              │
│ {                                                                            │
│   "params": {                                                                │
│     "traceId": "6bd48b719a2dd228"                                            │
│   },                                                                         │
│   "message": "No permissions to user or not existing",                       │
│   "type": "VError"                                                           │
│ }                                                                            │
╰──────────────────────────────────────────────────────────────────────────────╯

  ERROR STACK TRACE

  Please provide this when opening a bug report.

  ApiClientError: Unexpected response status (expected 200, got: 403)
      at ApiClientError.fromResponse (file:///opt/homebrew/Cellar/mw/1.0.0-alpha.21/libexec/node_modules/@mittwald/api-client-commons/dist/esm/core/ApiClientError.js:9:16)
      at assertStatus (file:///opt/homebrew/Cellar/mw/1.0.0-alpha.21/libexec/node_modules/@mittwald/api-client-commons/dist/esm/types/assertStatus.js:4:30)
      at Get.run (file:///opt/homebrew/Cellar/mw/1.0.0-alpha.21/libexec/dist/esm/GetBaseCommand.js:24:9)
      at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
      at async Get._run (/opt/homebrew/Cellar/mw/1.0.0-alpha.21/libexec/node_modules/@oclif/core/lib/command.js:117:22)
      at async Config.runCommand (/opt/homebrew/Cellar/mw/1.0.0-alpha.21/libexec/node_modules/@oclif/core/lib/config/config.js:329:25)
      at async Object.run (/opt/homebrew/Cellar/mw/1.0.0-alpha.21/libexec/node_modules/@oclif/core/lib/main.js:89:16)

The user is logged in, mw login status gives the user data and other command such as mw project list are working as well.

Wrong and missing command descriptions

/Users/thueske [thueske@MBP-M1-Hueske] [11:27]
> mw project
Manage your projects, and also any kinds of user memberships concerning these projects.

[...]

COMMANDS
  project create      Get the details of a project

add mw mail ForwardAddress

I would be great to add aliasses in bulk mode with cli

found myself using the command line for migration of large number of mailboxes with great fun!

mw mail --help
[…]
mail address Create a new mail address
mail deliverybox Get a specific deliverybox

Add IndentityFile support for `project ssh`

Using the native ssh command its possible to set an identity file using the option -i.

     -i identity_file
             Selects a file from which the identity (private key) for public key authentication is read.  You can also specify a public key file to use the corresponding private key that is loaded in ssh-agent(1) when the private key file is not present locally.  The default is
             ~/.ssh/id_rsa, ~/.ssh/id_ecdsa, ~/.ssh/id_ecdsa_sk, ~/.ssh/id_ed25519, ~/.ssh/id_ed25519_sk and ~/.ssh/id_dsa.  Identity files may also be specified on a per-host basis in the configuration file.  It is possible to have multiple -i options (and multiple identities specified
             in configuration files).  If no certificates have been explicitly specified by the CertificateFile directive, ssh will also try to load certificate information from the filename obtained by appending -cert.pub to identity filenames.

It would be great if the command mw project ssh would support a similar option.

Since the identity file is user based it can be used for all projects. So another option would be to add a command like mw login identity-file to set the file globally, so it must not be provided every time the command project ssh is used.

SSH-Verbindung in Apps ermöglichen

Als Nutzer möchte ich mich nicht nur in das Default-Environment meines Projekts per SSH verbinden, sondern auch in die Apps, um z.B. die korrekte PHP-Version zur Verfügung zu haben.

Output format JSON should always use ISO dates

When running the get command mw database mysql get with the flag --output json the dates are formatted as an ISO date string as expected.

~ ❯ mw database mysql get e404f33f-fce3-4f5b-ad47-************ --output json
{
  "createdAt": "2023-09-10T14:57:03.000Z",
  "id": "e404f33f-fce3-4f5b-ad47-************",
  "updatedAt": "2023-09-10T14:57:05.000Z",
  ...
}

Using the list command mw database mysql list --output json the date is shown in a human readable format.

~ ❯ mw database mysql list --output json                                    
[
  {
    "id": "e404f33f-fce3-4f5b-ad47-************",
    "createdAt": "25 minutes ago",
    ...
  }
]

If --output json is used, for all commands dates should be formatted as ISO dates.

Sort option has no effect to output

The option --sort for mw project list has no effect.

None of these commands produces an error, but the output table is sorted by created at.

mw project list --sort="customer-id" --extended
mw project list --sort="organisationId" --extended
mw project list --sort="customerId" --extended

Use context to filter list command

I’ve currently set the org-id context

~ ❯ mw context get                                              

Current CLI context

--project-id   not set
--server-id    not set
--org-id       65543619-a808-4787-bf1d-×××××××

When calling mw project list all project are listed, wich includes projects from other organisations.

It would be great to have to option to filter the output by the current context org-id or server-id.

Command for installing PHP app installs me node app

/Users/thueske [thueske@MBP-M1-Hueske] [11:38]
> mw app install php -p a028837b-3507-41c2-9402-cb46cd88e0d8 --site-title="WordPress" -q -w

  ERROR  Text string "233ea8ec-2f23-4469-93f4-4eb68c93d328" must be rendered inside <Text> component

 file:///opt/homebrew/Cellar/mw/1.0.0-alpha.20/libexec/node_modules/ink/build/reconciler.js:127:19

 - createTextInstance (file:///opt/homebrew/Cellar/mw/1.0.0-alpha.20/libexec/node_modules/ink/build/reconciler.js:127:19)
 - completeWork (/opt/homebrew/Cellar/mw/1.0.0-alpha.20/libexec/node_modules/react-reconciler/cjs/react-reconciler.development.js:13653:40)
 - completeUnitOfWork (/opt/homebrew/Cellar/mw/1.0.0-alpha.20/libexec/node_modules/react-reconciler/cjs/react-reconciler.development.js:18736:16)
 - performUnitOfWork (/opt/homebrew/Cellar/mw/1.0.0-alpha.20/libexec/node_modules/react-reconciler/cjs/react-reconciler.development.js:18711:5)
 - workLoopSync (/opt/homebrew/Cellar/mw/1.0.0-alpha.20/libexec/node_modules/react-reconciler/cjs/react-reconciler.development.js:18609:5)
 - renderRootSync (/opt/homebrew/Cellar/mw/1.0.0-alpha.20/libexec/node_modules/react-reconciler/cjs/react-reconciler.development.js:18577:7)
 - performSyncWorkOnRoot (/opt/homebrew/Cellar/mw/1.0.0-alpha.20/libexec/node_modules/react-reconciler/cjs/react-reconciler.development.js:18193:20)
 - flushSyncCallbacks (/opt/homebrew/Cellar/mw/1.0.0-alpha.20/libexec/node_modules/react-reconciler/cjs/react-reconciler.development.js:2936:22)
 - flushSyncCallbacksOnlyInLegacyMode (/opt/homebrew/Cellar/mw/1.0.0-alpha.20/libexec/node_modules/react-reconciler/cjs/react-reconciler.development.js:2915:5)
 - scheduleUpdateOnFiber (/opt/homebrew/Cellar/mw/1.0.0-alpha.20/libexec/node_modules/react-reconciler/cjs/react-reconciler.development.js:17646:7)
image

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.