Skip to content
This repository has been archived by the owner on May 6, 2024. It is now read-only.

Implement missing function calls and fix shebang detection #93

Open
wants to merge 21 commits into
base: main
Choose a base branch
from
Open

Implement missing function calls and fix shebang detection #93

wants to merge 21 commits into from

Conversation

Xevnar
Copy link

@Xevnar Xevnar commented Dec 3, 2022

I created a filetype.detect module that stores the functions used
to detect the filetypes of shell files.

The function I implemented checks is the shell name passed to it
is in the shebang table and sets filetype to that or it sets the
filetype to the shell name directly.

I also moved the analyze_shebang function to filetype_detect
since it fits there more than having it in the main module.

I moved getlines to filetype.util and renamed it to
getlines_as_string

The shell functions I added were taken from vim.filetype.detect
but I modified the behaviour so that it bash, ksh, and dash do
not get converted to sh filetype and instead it is up to the user
to do so if they want.

I also fixed some broken muttrc lua patterns and added a mapping for
.service files.

closes: #79,#34 Can correctly identify shebangs with arguments
closes: #63 Can correctly identify python3 files as python
closes: #43 Provide an option to set a default filetype
closes: #91 all dist#ft functions that are being used have been ported over
closes: #73 map .service files to systemd filetype

I created a `filetype.detect` module that stores the functions used
to detect the filetypes of shell files.

The function I implemented checks is the shell name passed to it
is in the shebang table and sets filetype to that or it sets the
filetype to the shell name directly.

I also moved the `analyze_shebang` function to `filetype_detect`
since it fits there more than having it in the main module.

I moved `getlines` to `filetype.util` and renamed it to
`getlines_as_string`

The shell functions I added were taken from `vim.filetype.detect`
but I modified the behaviour so that it bash, ksh, and dash do
not get converted to sh filetype and instead it is up to the user
to do so if they want.

closes: #79,#34 Can correctly identify shebangs with arguments
closes: #63 Can correctly identify python3 files as python
closes: #43 Provide an option to set a default filetype
…tion callback

This allows for more intricate functions to be written that provide
better filetype detection
closes: #91 all `dist#ft` functions that are being used have been ported over
@Xevnar Xevnar closed this by deleting the head repository Dec 6, 2022
@Xevnar Xevnar reopened this Dec 6, 2022
@Xevnar
Copy link
Author

Xevnar commented Dec 6, 2022

My bad, I didn't know that deleting the original repository also affected the pull request.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
1 participant