Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into feat/use_esbuild
Browse files Browse the repository at this point in the history
  • Loading branch information
cstrnt committed Jul 19, 2021
2 parents 192a412 + 47ba8dd commit 255d845
Show file tree
Hide file tree
Showing 22 changed files with 4,827 additions and 211 deletions.
46 changes: 0 additions & 46 deletions .github/ISSUE_TEMPLATE/bug.md

This file was deleted.

18 changes: 0 additions & 18 deletions .github/ISSUE_TEMPLATE/cli_request.md

This file was deleted.

10 changes: 5 additions & 5 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
---
blank_issues_enabled: true
contact_links:
- about: "Create a new issue in the withfig/fig repo to be directed to the right place"
name: Not an autocomplete issue?
- about: "My issue does not relate to a specific completion spec - withfig/fig"
name: Other Issue
url: "https://github.com/withfig/fig/issues/new/choose"
- about: "Fig's support knowledge base"
name: "💬 User Support"
url: "https://fig.io/support"
- about: "Find detailed guides about common support issues in our forum"
name: "💬 GitHub Discussions"
url: "https://github.com/withfig/fig/discussions"
- about: "Get instant support from the Fig Community Discord"
name: "👋 Discord"
url: "https://fig.io/community"
Expand Down
25 changes: 0 additions & 25 deletions .github/ISSUE_TEMPLATE/enhancement.md

This file was deleted.

38 changes: 38 additions & 0 deletions .github/ISSUE_TEMPLATE/main_issue_template.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Completion Spec Issue
title: "[CLI_NAME]"
description: All issues relating to specific CLI tools (e.g. `git`, `kubectl`, `chmod`)
labels: [NEED_TO_LABEL]
body:
- type: checkboxes
attributes:
label: Sanity checks
options:
- label: "My issue relates to a specific CLI completion spec (e.g. `git checkout` is missing options in `git` completion spec). If your issue is more general, please create your issue here: [withfig/fig](https://github.com/withfig/fig/issues/new?assignees=&labels=NEED_TO_LABEL&template=main_issue_template.yml)"
required: true
- label: "I have searched [github.com/withfig/autocomplete/issues](https://github.com/withfig/autocomplete/issues?q=) and there are no duplicates of my issue"
required: true
- type: input
attributes:
label: What CLI tool does this relate to?
description: "If it relates to all of them, you probably want to create your issue here: [withfig/fig](https://github.com/withfig/fig/issues/new?assignees=&labels=NEED_TO_LABEL&template=main_issue_template.yml)"
placeholder: "git"
validations:
required: true
- type: dropdown
attributes:
label: Which statement makes the most sense?
options:
- "There is a bug with this completion spec"
- "There are errors with this completion spec"
- "This completion spec does not exist"
- "This completion spec isn't complete"
- "Something else"
validations:
required: true
- type: textarea
attributes:
label: Issue Details
description: Tell us more about the issue
placeholder: What subcommands / options / arguments are relevant? If a generator needs to be written, please specifiy the desired output.
validations:
required: true
13 changes: 0 additions & 13 deletions .github/ISSUE_TEMPLATE/other.md

This file was deleted.

25 changes: 19 additions & 6 deletions dev/aws.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
const completionSpec: Fig.Spec = {
name: "aws",
async generateSpec(_, executeShellCommand) {
const check = await executeShellCommand(
"ls ~/.aws/credentials && ls ~/.aws/config"
);
const prioritize = check.includes("No such file or directory");
return {
name: "aws",
subcommands: [
{
name: "configure",
description:
"Configure AWS CLI options. If this command is run with no\narguments, you will be prompted for configuration values such as your AWS\nAccess Key Id and your AWS Secret Access Key. You can configure a named\nprofile using the ``--profile`` argument. If your config file does not exist\n(the default location is ``~/.aws/config``), the AWS CLI will create it\nfor you. To keep an existing value, hit enter when prompted for the value.\nWhen you are prompted for information, the current value will be displayed in\n``[brackets]``. If the config item has no value, it be displayed as\n``[None]``. Note that the ``configure`` command only works with values from the\nconfig file. It does not use any configuration values from environment\nvariables or the IAM role.\n\nNote: the values you provide for the AWS Access Key ID and the AWS Secret\nAccess Key will be written to the shared credentials file\n(``~/.aws/credentials``).\n\n\n=======================\nConfiguration Variables\n=======================\n\nThe following configuration variables are supported in the config file:\n\n* **aws_access_key_id** - The AWS access key part of your credentials\n* **aws_secret_access_key** - The AWS secret access key part of your credentials\n* **aws_session_token** - The session token part of your credentials (session tokens only)\n* **metadata_service_timeout** - The number of seconds to wait until the metadata service\n request times out. This is used if you are using an IAM role to provide\n your credentials.\n* **metadata_service_num_attempts** - The number of attempts to try to retrieve\n credentials. If you know for certain you will be using an IAM role on an\n Amazon EC2 instance, you can set this value to ensure any intermittent\n failures are retried. By default this value is 1.\n\nFor more information on configuration options, see `Configuring the AWS Command Line Interface`_ in the *AWS CLI User Guide*.\n\n.. _`Configuring the AWS Command Line Interface`: http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html\n",
loadSpec: "aws/configure",
icon: "fig://icon?type=alert",
priority: prioritize ? 100 : 50,
},
],
};
},
subcommands: [
{
name: "accessanalyzer",
Expand Down Expand Up @@ -1532,12 +1551,6 @@ const completionSpec: Fig.Spec = {
'This section explains prominent concepts and notations in the set of high-level S3 commands provided.\n\nPath Argument Type\n++++++++++++++++++\n\nWhenever using a command, at least one path argument must be specified. There\nare two types of path arguments: ``LocalPath`` and ``S3Uri``.\n\n``LocalPath``: represents the path of a local file or directory. It can be\nwritten as an absolute path or relative path.\n\n``S3Uri``: represents the location of a S3 object, prefix, or bucket. This\nmust be written in the form ``s3://mybucket/mykey`` where ``mybucket`` is\nthe specified S3 bucket, ``mykey`` is the specified S3 key. The path argument\nmust begin with ``s3://`` in order to denote that the path argument refers to\na S3 object. Note that prefixes are separated by forward slashes. For\nexample, if the S3 object ``myobject`` had the prefix ``myprefix``, the\nS3 key would be ``myprefix/myobject``, and if the object was in the bucket\n``mybucket``, the ``S3Uri`` would be ``s3://mybucket/myprefix/myobject``.\n\n``S3Uri`` also supports S3 access points. To specify an access point, this\nvalue must be of the form ``s3://<access-point-arn>/<key>``. For example if\nthe access point ``myaccesspoint`` to be used has the ARN:\n``arn:aws:s3:us-west-2:123456789012:accesspoint/myaccesspoint`` and the object\nbeing accessed has the key ``mykey``, then the ``S3URI`` used must be:\n``s3://arn:aws:s3:us-west-2:123456789012:accesspoint/myaccesspoint/mykey``.\nSimilar to bucket names, you can also use prefixes with access point ARNs for\nthe ``S3Uri``. For example:\n``s3://arn:aws:s3:us-west-2:123456789012:accesspoint/myaccesspoint/myprefix/``\n\nThe higher level ``s3`` commands do **not** support access point object ARNs.\nFor example, if the following was specified:\n``s3://arn:aws:s3:us-west-2:123456789012:accesspoint/myaccesspoint/object/mykey``\nthe ``S3URI`` will resolve to the object key ``object/mykey``\n\n\n\nOrder of Path Arguments\n+++++++++++++++++++++++\n\nEvery command takes one or two positional path arguments. The first path\nargument represents the source, which is the local file/directory or S3\nobject/prefix/bucket that is being referenced. If there is a second path\nargument, it represents the destination, which is the local file/directory\nor S3 object/prefix/bucket that is being operated on. Commands with only\none path argument do not have a destination because the operation is being\nperformed only on the source.\n\n\nSingle Local File and S3 Object Operations\n++++++++++++++++++++++++++++++++++++++++++\n\nSome commands perform operations only on single files and S3 objects. The\nfollowing commands are single file/object operations if no ``--recursive``\nflag is provided.\n\n * ``cp``\n * ``mv``\n * ``rm``\n\nFor this type of operation, the first path argument, the source, must exist\nand be a local file or S3 object. The second path argument, the destination,\ncan be the name of a local file, local directory, S3 object, S3 prefix,\nor S3 bucket.\n\nThe destination is indicated as a local directory, S3 prefix, or S3 bucket\nif it ends with a forward slash or back slash. The use of slash depends\non the path argument type. If the path argument is a ``LocalPath``,\nthe type of slash is the separator used by the operating system. If the\npath is a ``S3Uri``, the forward slash must always be used. If a slash\nis at the end of the destination, the destination file or object will\nadopt the name of the source file or object. Otherwise, if there is no\nslash at the end, the file or object will be saved under the name provided.\nSee examples in ``cp`` and ``mv`` to illustrate this description.\n\n\nDirectory and S3 Prefix Operations\n++++++++++++++++++++++++++++++++++\n\nSome commands only perform operations on the contents of a local directory\nor S3 prefix/bucket. Adding or omitting a forward slash or back slash to\nthe end of any path argument, depending on its type, does not affect the\nresults of the operation. The following commands will always result in\na directory or S3 prefix/bucket operation:\n\n* ``sync``\n* ``mb``\n* ``rb``\n* ``ls``\n\n\nUse of Exclude and Include Filters\n++++++++++++++++++++++++++++++++++\n\nCurrently, there is no support for the use of UNIX style wildcards in\na command\'s path arguments. However, most commands have ``--exclude "<value>"``\nand ``--include "<value>"`` parameters that can achieve the desired result.\nThese parameters perform pattern matching to either exclude or include\na particular file or object. The following pattern symbols are supported.\n\n * ``*``: Matches everything\n * ``?``: Matches any single character\n * ``[sequence]``: Matches any character in ``sequence``\n * ``[!sequence]``: Matches any character not in ``sequence``\n\nAny number of these parameters can be passed to a command. You can do this by\nproviding an ``--exclude`` or ``--include`` argument multiple times, e.g.\n``--include "*.txt" --include "*.png"``.\nWhen there are multiple filters, the rule is the filters that appear later in\nthe command take precedence over filters that appear earlier in the command.\nFor example, if the filter parameters passed to the command were\n\n::\n\n --exclude "*" --include "*.txt"\n\nAll files will be excluded from the command except for files ending with\n``.txt`` However, if the order of the filter parameters was changed to\n\n::\n\n --include "*.txt" --exclude "*"\n\nAll files will be excluded from the command.\n\nEach filter is evaluated against the **source directory**. If the source\nlocation is a file instead of a directory, the directory containing the file is\nused as the source directory. For example, suppose you had the following\ndirectory structure::\n\n /tmp/foo/\n .git/\n |---config\n |---description\n foo.txt\n bar.txt\n baz.jpg\n\nIn the command ``aws s3 sync /tmp/foo s3://bucket/`` the source directory is\n``/tmp/foo``. Any include/exclude filters will be evaluated with the source\ndirectory prepended. Below are several examples to demonstrate this.\n\nGiven the directory structure above and the command\n``aws s3 cp /tmp/foo s3://bucket/ --recursive --exclude ".git/*"``, the\nfiles ``.git/config`` and ``.git/description`` will be excluded from the\nfiles to upload because the exclude filter ``.git/*`` will have the source\nprepended to the filter. This means that::\n\n /tmp/foo/.git/* -> /tmp/foo/.git/config (matches, should exclude)\n /tmp/foo/.git/* -> /tmp/foo/.git/description (matches, should exclude)\n /tmp/foo/.git/* -> /tmp/foo/foo.txt (does not match, should include)\n /tmp/foo/.git/* -> /tmp/foo/bar.txt (does not match, should include)\n /tmp/foo/.git/* -> /tmp/foo/baz.jpg (does not match, should include)\n\nThe command ``aws s3 cp /tmp/foo/ s3://bucket/ --recursive --exclude "ba*"``\nwill exclude ``/tmp/foo/bar.txt`` and ``/tmp/foo/baz.jpg``::\n\n /tmp/foo/ba* -> /tmp/foo/.git/config (does not match, should include)\n /tmp/foo/ba* -> /tmp/foo/.git/description (does not match, should include)\n /tmp/foo/ba* -> /tmp/foo/foo.txt (does not match, should include)\n /tmp/foo/ba* -> /tmp/foo/bar.txt (matches, should exclude)\n /tmp/foo/ba* -> /tmp/foo/baz.jpg (matches, should exclude)\n\n\nNote that, by default, *all files are included*. This means that\nproviding **only** an ``--include`` filter will not change what\nfiles are transferred. ``--include`` will only re-include files that\nhave been excluded from an ``--exclude`` filter. If you only want\nto upload files with a particular extension, you need to first exclude\nall files, then re-include the files with the particular extension.\nThis command will upload **only** files ending with ``.jpg``::\n\n aws s3 cp /tmp/foo/ s3://bucket/ --recursive --exclude "*" --include "*.jpg"\n\nIf you wanted to include both ``.jpg`` files as well as ``.txt`` files you\ncan run::\n\n aws s3 cp /tmp/foo/ s3://bucket/ --recursive \\\n --exclude "*" --include "*.jpg" --include "*.txt"\n',
loadSpec: "aws/s3",
},
{
name: "configure",
description:
"Configure AWS CLI options. If this command is run with no\narguments, you will be prompted for configuration values such as your AWS\nAccess Key Id and your AWS Secret Access Key. You can configure a named\nprofile using the ``--profile`` argument. If your config file does not exist\n(the default location is ``~/.aws/config``), the AWS CLI will create it\nfor you. To keep an existing value, hit enter when prompted for the value.\nWhen you are prompted for information, the current value will be displayed in\n``[brackets]``. If the config item has no value, it be displayed as\n``[None]``. Note that the ``configure`` command only works with values from the\nconfig file. It does not use any configuration values from environment\nvariables or the IAM role.\n\nNote: the values you provide for the AWS Access Key ID and the AWS Secret\nAccess Key will be written to the shared credentials file\n(``~/.aws/credentials``).\n\n\n=======================\nConfiguration Variables\n=======================\n\nThe following configuration variables are supported in the config file:\n\n* **aws_access_key_id** - The AWS access key part of your credentials\n* **aws_secret_access_key** - The AWS secret access key part of your credentials\n* **aws_session_token** - The session token part of your credentials (session tokens only)\n* **metadata_service_timeout** - The number of seconds to wait until the metadata service\n request times out. This is used if you are using an IAM role to provide\n your credentials.\n* **metadata_service_num_attempts** - The number of attempts to try to retrieve\n credentials. If you know for certain you will be using an IAM role on an\n Amazon EC2 instance, you can set this value to ensure any intermittent\n failures are retried. By default this value is 1.\n\nFor more information on configuration options, see `Configuring the AWS Command Line Interface`_ in the *AWS CLI User Guide*.\n\n.. _`Configuring the AWS Command Line Interface`: http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html\n",
loadSpec: "aws/configure",
},
{
name: "deploy",
description:
Expand Down
Loading

0 comments on commit 255d845

Please sign in to comment.