Is there a feature allowing custom "Allow?" CLI inputs?
For example, if you
deno run
some program that reads from the file system, you're prompted Deno requests read access to... Allow?
and you specify whether or not you want Deno to proceed. Is there any built-in or native feature that would let me cause the same kind of CLI "Allow?" prompt to appear with a custom message?3 Replies
Input Prompts - Deno by Example
Prompts are used to ask the user for input or feedback on actions. -- Deno by example is a collection of annotated examples for how to use Deno, and the various features it provides.
I wasn't able to find the answer to your question in the official Deno documentation. However, based on your description, it seems like you're asking about creating custom permission prompts within a Deno program.
Deno's permission prompts are a built-in feature of the runtime for security-sensitive operations, such as file system access, network access, etc. These prompts are not designed to be customizable by users or to be used for arbitrary confirmation messages within scripts.
If you're looking to implement a custom "Allow?" prompt for your own logic within a Deno script, you would typically handle this by writing your own function to prompt the user and process their input. This isn't a feature provided by Deno's permissions API, but you can use Deno's standard input (stdin) to achieve something similar.
Here's a simple example of how you might implement a custom prompt:
Please note that this advice is not based on the Deno documentation, and I would advise you to double-check the accuracy of the advice given. If you're looking for more advanced CLI interaction, you might want to look into third-party libraries that provide more sophisticated command-line interface tools.
Deno.pernissions.request
is probably what you're looking for