Zum Hauptinhalt springen

Rename Asset (zeysdk rename)

Rename an existing asset while maintaining its configuration in your ZeyOS application.

zeysdk rename <ASSET_CLASS>/<OLD_FILENAME> <ASSET_CLASS>/<NEW_FILENAME> [options]

Parameters

ParameterDescriptionRequiredExample
<ASSET_CLASS>/<OLD_FILENAME>Source asset pathservices/old-backup.ixml
<ASSET_CLASS>/<NEW_FILENAME>Destination asset pathservices/new-backup.ixml

Options

OptionDescriptionDefault
--verboseShow detailed progress outputfalse

Validation Rules

  1. Source Validation

    • Asset class must be valid (services, resources, weblets)
    • Source file must exist in zeyos.app.json
    • Source file must exist in filesystem
  2. Destination Validation

    • Asset classes must match between source and destination
    • Destination must not already exist
    • New filename must be valid
  3. Configuration

    • zeyos.app.json must exist
    • Asset must be properly configured

Examples

# Rename a service
zeysdk rename services/old-backup.ixml services/new-backup.ixml --verbose
# Output:
# Loading assets info.
# Updating assets info.
# Renaming file.
# Rename was completed successfully.

# Rename a weblet (changing extension)
zeysdk rename weblets/dashboard.ixml weblets/dashboard-test.ixml
# Updates mimetype automatically

# Rename a resource
zeysdk rename resources/old-logo.png resources/new-logo.png

Error Handling

ErrorDescriptionResolutionExample Message
Invalid argumentsMissing parametersProvide both pathsexpects at least 2 arguments
Asset class mismatchDifferent classesUse same classexpects the <ASSET_CLASS> directory to be the same
Invalid asset classWrong typeUse valid classshould be a valid <ASSET_CLASS>: services, resources, weblets
Missing configNo app.jsonInitialize apprequires the zeyos.app.json file to exist
Source missingSource not foundCheck source pathrequires the asset to exist
Destination existsTarget existsChoose different namerequires the destination file to not exist
Rename failedFile system errorCheck permissionsThere was a problem renaming the file

Automatic Updates

The following are automatically handled:

  1. MIME type updates based on new extension
  2. Configuration key updates
  3. File system changes
  4. Backup creation and restoration
  5. Validation checks