-
-
Notifications
You must be signed in to change notification settings - Fork 108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Re-write of directory_writer in Julia #190
Open
ChrisO345
wants to merge
14
commits into
TheAlgorithms:main
Choose a base branch
from
ChrisO345:directory_writer
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
491f64a
updated directory writer to be written in julia
ChrisO345 f7b2b0f
updating DIRECTORY.md
1ed8743
fixed minor changes
ChrisO345 50edbd2
Merge branch 'main' into directory_writer
uncomfyhalomacro 3c4032d
Merge branch 'main' into directory_writer
uncomfyhalomacro 7712892
Merge branch 'main' into directory_writer
uncomfyhalomacro ccb71bb
updating DIRECTORY.md
a629d5d
Merge branch 'main' into directory_writer
uncomfyhalomacro c72b21f
updating DIRECTORY.md
d853379
Merge branch 'main' into directory_writer
Panquesito7 6f13e44
updating DIRECTORY.md
9651f46
Update .github/workflows/directory_writer.yml
uncomfyhalomacro bf25395
Update .github/workflows/directory_writer.yml
uncomfyhalomacro de99466
Update scripts/directory_writer.jl
uncomfyhalomacro File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
URL_BASE = "https://github.com/TheAlgorithms/Julia/blob/HEAD/src" | ||
|
||
function get_list_files(path, extension=".jl") | ||
list_files = [] | ||
dir_names = String[] | ||
for (root, dirs, files) in walkdir(path) | ||
current_dir = String[] | ||
strip_root = replace(root, "src/" => "") | ||
if strip_root != "src" | ||
push!(dir_names, strip_root) | ||
end | ||
for file in files | ||
if file == "TheAlgorithms.jl" | ||
continue | ||
end | ||
if endswith(file, extension) | ||
push!(current_dir, replace(file, extension => "")) | ||
end | ||
end | ||
if length(current_dir) > 0 | ||
push!(list_files, current_dir) | ||
end | ||
end | ||
return list_files, dir_names | ||
end | ||
|
||
function title(words) | ||
words = split(replace(lowercase(words), " " => "_"), "_") | ||
titled_words = [uppercasefirst(word) for word in words] | ||
return join(titled_words, " ") | ||
end | ||
|
||
function print_directory() | ||
outputs = "\n## TheAlgorithms\n" | ||
files, dirs = get_list_files("src") | ||
for i in eachindex(dirs) | ||
factor = 1 | ||
if contains(dirs[i], "/") | ||
dir = split(dirs[i], "/") | ||
factor = length(dir) | ||
dir = dir[end] | ||
else | ||
dir = dirs[i] | ||
end | ||
outputs *= " " ^ factor * "* $(title(dir))\n" | ||
for j in files[i] | ||
outputs *= " " ^ factor * " * [$(title(j))]($URL_BASE/$(dirs[i])/$(replace(j, " " => "%20")).jl)\n" | ||
end | ||
end | ||
println(outputs) | ||
end | ||
|
||
print_directory() |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This won't work as the
main
branch is protected. We need to create a pull request, and then merge it, just like the previous workflow.