Skip to content

Commit

Permalink
Remove vim.lang from syntax
Browse files Browse the repository at this point in the history
Point users of Cylc Get Resources to the new cylc.vim plugin.
  • Loading branch information
wxtim committed Jan 10, 2025
1 parent 26df668 commit feb0752
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 117 deletions.
115 changes: 0 additions & 115 deletions cylc/flow/etc/syntax/cylc.vim

This file was deleted.

12 changes: 10 additions & 2 deletions cylc/flow/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

"""Extract named resources from the cylc.flow package."""

from ansimarkup import parse
from contextlib import suppress
from pathlib import Path
from random import choice
Expand All @@ -39,10 +40,10 @@
RESOURCE_NAMES = {
'syntax/cylc-mode.el': 'Emacs syntax highlighting.',
'syntax/cylc.lang': 'Gedit (gtksourceview) syntax highlighting.',
'syntax/cylc.vim': 'Vim syntax highlighting.',
'syntax/cylc.xml': 'Kate syntax highlighting.',
'cylc-completion.bash': 'Bash auto-completion for Cylc commands.',
'cylc': 'Cylc wrapper script.',
'!syntax/cylc.vim': 'Deprecated - use https://github.com/cylc/cylc.vim',
}
API_KEY = 'api-key'

Expand All @@ -63,7 +64,14 @@ def list_resources(write=print, headers=True):
write('Resources:')
max_len = max(len(res) for res in RESOURCE_NAMES)
for resource, desc in RESOURCE_NAMES.items():
write(f' {resource} {" " * (max_len - len(resource))} # {desc}')
if resource[0] == '!':
resource = resource[1:]
write(parse(
f'<yellow> {resource} {" " * (max_len - len(resource))}'
f' # {desc}</yellow>'
))
else:
write(f' {resource} {" " * (max_len - len(resource))} # {desc}')
if headers:
write('\nTutorials:')
for tutorial in tutorials:
Expand Down
9 changes: 9 additions & 0 deletions cylc/flow/scripts/get_resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
import sys

from cylc.flow import LOG
from cylc.flow.exceptions import CylcError
import cylc.flow.flags
from cylc.flow.loggingutil import set_timestamps
from cylc.flow.option_parsers import CylcOptionParser as COP
Expand Down Expand Up @@ -74,6 +75,14 @@ def get_option_parser():

@cli_function(get_option_parser)
def main(parser, opts, resource=None, tgt_dir=None):

# Intercept requests for syntax/cylc.vim:
if resource == "syntax/cylc.vim":
raise CylcError(
'syntax/cylc.vim has been replaced by '
'https://github.com/cylc/cylc.vim'
)

if cylc.flow.flags.verbosity < 2:
set_timestamps(LOG, False)
if not resource or opts.list:
Expand Down

0 comments on commit feb0752

Please sign in to comment.