Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move references to issues and versions supporting XDG to separate keys #376

Open
EmilyGraceSeville7cf opened this issue Feb 28, 2024 · 0 comments

Comments

@EmilyGraceSeville7cf
Copy link
Contributor

I propose a change which allows:

  • listing all versions with XDG support outside files.{{file}}.help
  • linking related issues outside files.{{file}}.help
{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "definitions": {
    "empty": {
      "type": "string",
      "pattern": "^\\s+$"
    },
    "version": {
      "type": "string",
      "not": {
        "anyOf": [
          {
            "$ref": "#/definitions/empty"
          },
          {
            "pattern": "\\.\\."
          }
        ]
      },
      "examples": ["1.2.3"]
    }
  },
  "title": "specification",
  "description": "A specification of files or folders in the $HOME folder for a program\nhttps://github.com/b3nj5m1n/xdg-ninja",
  "type": "object",
  "required": ["name", "files"],
  "properties": {
    "name": {
      "title": "name",
      "description": "A program name\nRestrictions:\n- can't contain just spaces\nhttps://github.com/b3nj5m1n/xdg-ninja",
      "type": "string",
      "minLength": 1,
      "not": {
        "$ref": "#/definitions/empty"
      },
      "examples": ["abook"]
    },
    "files": {
      "title": "files",
      "description": "Files and folders for a program\nhttps://github.com/b3nj5m1n/xdg-ninja",
      "type": "array",
      "uniqueItems": true,
      "minItems": 1,
      "items": {
        "description": "A file or a folder for a program\nhttps://github.com/b3nj5m1n/xdg-ninja",
        "type": "object",
        "required": ["path", "movable", "help"],
        "properties": {
          "path": {
            "title": "path",
            "description": "A path to a file or a folder\nRestrictions:\n- can't contain just spaces\nhttps://github.com/b3nj5m1n/xdg-ninja",
            "type": "string",
            "minLength": 1,
            "not": {
              "$ref": "#/definitions/empty"
            },
            "examples": ["$HOME/.abook"]
          },
          "movable": {
            "title": "movable",
            "description": "Whether a file or a folder is movable to a place other than $HOME\nhttps://github.com/b3nj5m1n/xdg-ninja",
            "type": "boolean"
          },
          "help": {
            "title": "help",
            "description": "A help message for a user in markdown\nRestrictions:\n- can't contain just spaces\nhttps://github.com/b3nj5m1n/xdg-ninja",
            "type": "string",
            "minLength": 1,
            "not": {
              "$ref": "#/definitions/empty"
            },
            "examples": [
              "Alias abook to use custom locations for configuration and data:\n\n```bash\nalias abook=abook --config \"$XDG_CONFIG_HOME\"/abook/abookrc --datafile \"$XDG_DATA_HOME\"/abook/addressbook\n```\n"
            ]
          },
          "supported": {
            "title": "supported",
            "description": "Versions XDG specification is supported\nRestrictions:\n- can't contain just spaces\n- can't contain two or more consecutive dots\nhttps://github.com/b3nj5m1n/xdg-ninja",
            "oneOf": [
              {
                "$ref": "#/definitions/version"
              },
              {
                "type": "array",
                "minItems": 1,
                "uniqueItems": true,
                "items": {
                  "type": "object",
                  "properties": {
                    "from": {
                      "description": "A version XDG specification is supported since\nRestrictions:\n- can't contain just spaces\n- can't contain two or more consecutive dots\nhttps://github.com/b3nj5m1n/xdg-ninja",
                      "$ref": "#/definitions/version"
                    },
                    "to": {
                      "description": "A version XDG specification is supported till\nRestrictions:\n- can't contain just spaces\n- can't contain two or more consecutive dots\nhttps://github.com/b3nj5m1n/xdg-ninja",
                      "$ref": "#/definitions/version"
                    }
                  },
                  "minProperties": 1,
                  "additionalProperties": false
                }
              }
            ]
          },
          "issues": {
            "title": "issues",
            "description": "Linked issues to explain such things like plans on adding XDG specification support, reason for dropping it\nRestrictions:\n- can't contain just spaces\nhttps://github.com/b3nj5m1n/xdg-ninja",
            "type": "array",
            "minItems": 1,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "pattern": "^https://",
              "not": {
                "$ref": "#/definitions/empty"
              },
              "examples": ["https://github.com/nektos/act/issues/1678"]
            }
          }
        }
      }
    }
  }
}

Examples

act.json can be rewritten as:

{
  "name": "act",
  "files": [
    {
      "path": "$HOME/.actrc",
      "movable": true,
      "help": "Act supports the XDG spec.\n\n```sh\nmkdir \"$XDG_CONFIG_HOME/act\"\nmv .actrc \"$XDG_CONFIG_HOME/act/actrc\"\n```\n",
      "issues": ["https://github.com/nektos/act/issues/1678"]
    }
  ]
}

Note how issue reference has been moved from files.{{file}}.help to files.{{file}}.issues.

aegisub.json can be rewritten as:

{
    "files": [
        {
            "help": "Some help text",
            "movable": false,
            "path": "$HOME/.aegisub",
            "issues": ["https://github.com/Aegisub/Aegisub/issues/226"]
        }
    ],
    "name": "Aegisub"
}

Note that is there is no files.{{file}}.supported which means no versions support XDG specification.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant