Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Utilities
Kate
Commits
7cb6078b
Commit
7cb6078b
authored
Feb 07, 2021
by
Christoph Cullmann
🐮
Browse files
small perl helper to create a meta project, just for testing
parent
c7120488
Changes
1
Show whitespace changes
Inline
Side-by-side
addons/project/metaproject.pl
0 → 100755
View file @
7cb6078b
#!/usr/bin/perl -w
use
strict
;
use
warnings
;
use
File::
Find
;
use
File::
Spec
;
# only param: directory we shall collect stuff recursively in
my
$dir
=
shift
;
if
(
!
defined
(
$dir
))
{
die
"
Usage: metaproject.pl <directory>
\n
";
}
# collect all .kateprojects below the passed directory
my
@projects
;
sub
find_project
{
if
(
$
File::Find::
name
=~
/^.+\/\.kateproject/
)
{
push
@projects
,
$
File::Find::
dir
;
}
}
find
(
\
&find_project
,
$dir
);
# construct kate project json file
open
P
,
"
>
$dir
/.kateproject
";
print
P
"
{
\n
";
print
P
"
\"
files
\"
: [
\n
";
# insert all projects we found
print
P
"
{
\"
projects
\"
: [
";
my
$first
=
1
;
foreach
my
$project
(
sort
@projects
)
{
# compute relative project path, skip ourself
my
$relproject
=
File::
Spec
->
abs2rel
(
$project
,
$dir
);
$relproject
=~
s/[\/\\]?\.kateproject$//
;
next
if
(
$relproject
eq
""
||
$relproject
eq
"
.
");
# add to our projects list
if
(
$first
==
0
)
{
print
P
"
,
";
}
print
P
"
\n
\"
"
.
$relproject
.
"
\"
";
$first
=
0
;
}
print
P
"
]
\n
} ]
\n
";
# be done ;)
print
P
"
}
\n
";
close
P
;
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment