mirror of
https://github.com/jimeh/vscode-make-executable-if-script.git
synced 2026-02-19 11:36:40 +00:00
60 lines
1.7 KiB
Markdown
60 lines
1.7 KiB
Markdown
# Make Executable If Script
|
|
|
|
> [!WARNING]
|
|
> This extension is currently a unfinished work in progress, and mostly written
|
|
> by AI. The idea was simply to get a very quick intro to VSCode extension
|
|
> development, with a goal of actually diving deeper to understand things
|
|
> properly at a later date.
|
|
|
|
A VSCode extension that automatically makes files executable when they start
|
|
with a hashbang (`#!`).
|
|
|
|
## Features
|
|
|
|
- Automatically marks files as executable when saved if they start with `#!`
|
|
(enabled by default).
|
|
- Manual command to mark current file as executable if it has a hashbang.
|
|
- Shows permission changes in a non-intrusive way.
|
|
- Works with any script type (bash, python, perl, etc.)
|
|
|
|
## Usage
|
|
|
|
### Automatic Mode (Default)
|
|
|
|
By default, any file you save that starts with `#!` will automatically be made
|
|
executable if it isn't already. For example:
|
|
|
|
```bash
|
|
#!/bin/bash
|
|
echo "Hello World"
|
|
```
|
|
|
|
Save the file, and it will automatically be made executable.
|
|
|
|
### Manual Mode
|
|
|
|
You can also manually mark a file as executable:
|
|
|
|
1. Open the Command Palette (Cmd+Shift+P / Ctrl+Shift+P)
|
|
2. Type "Make Executable If Script"
|
|
3. Press Enter
|
|
|
|
The command will only make the file executable if it starts with `#!`.
|
|
|
|
## Extension Settings
|
|
|
|
This extension contributes the following settings:
|
|
|
|
- `make-executable-if-script.autoMarkOnSave`: Enable/disable automatic marking
|
|
of files as executable on save (default: `true`)
|
|
- `make-executable-if-script.silent`: Suppress notifications when files are made
|
|
executable (default: `false`)
|
|
|
|
## Platform Support
|
|
|
|
### Unix-like Systems (macOS, Linux)
|
|
|
|
- Makes files executable using `chmod +x`
|
|
- Preserves existing file extension
|
|
- Works with all script types
|