Skip to content

#1788: Created a commandlet to simulate the behaviour of ln -s#1847

Open
KarimALotfy wants to merge 2 commits intodevonfw:mainfrom
KarimALotfy:feature/1788-add-ln-commandlet-to-create-links
Open

#1788: Created a commandlet to simulate the behaviour of ln -s#1847
KarimALotfy wants to merge 2 commits intodevonfw:mainfrom
KarimALotfy:feature/1788-add-ln-commandlet-to-create-links

Conversation

@KarimALotfy
Copy link
Copy Markdown

This PR fixes #1788

Implemented changes:

Added ide ln -s commandlet to create file links.


Checklist for this PR

Make sure everything is checked before merging this PR. For further info please also see
our DoD.

  • When running mvn clean test locally all tests pass and build is successful
  • PR title is of the form #«issue-id»: «brief summary» (e.g. #921: fixed setup.bat). If no issue ID exists, title only.
  • PR top-level comment summarizes what has been done and contains link to addressed issue(s)
  • PR and issue(s) have suitable labels
  • Issue is set to In Progress and assigned to you or there is no issue (might happen for very small PRs)
  • You followed all coding conventions
  • You have added the issue implemented by your PR in CHANGELOG.adoc unless issue is labeled
    with internal

@github-project-automation github-project-automation Bot moved this to 🆕 New in IDEasy board Apr 23, 2026
@KarimALotfy KarimALotfy self-assigned this Apr 23, 2026
@KarimALotfy KarimALotfy moved this from 🆕 New to Team Review in IDEasy board Apr 23, 2026
@coveralls
Copy link
Copy Markdown
Collaborator

coveralls commented Apr 23, 2026

Coverage Report for CI Build 24888645898

Coverage decreased (-0.2%) to 70.483%

Details

  • Coverage decreased (-0.2%) from the base build.
  • Patch coverage: No coverable lines changed in this PR.
  • 11 coverage regressions across 2 files.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

11 previously-covered lines in 2 files lost coverage.

File Lines Losing Coverage Coverage
com/devonfw/tools/ide/commandlet/CommandletManagerImpl.java 8 90.26%
com/devonfw/tools/ide/git/repository/RepositoryCommandlet.java 3 70.98%

Coverage Stats

Coverage Status
Relevant Lines: 15337
Covered Lines: 11276
Line Coverage: 73.52%
Relevant Branches: 6830
Covered Branches: 4348
Branch Coverage: 63.66%
Branches in Coverage %: Yes
Coverage Strength: 3.11 hits per line

💛 - Coveralls

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Apr 23, 2026

CLA assistant check
All committers have signed the CLA.

Copy link
Copy Markdown
Contributor

@jakozian jakozian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice approach! But i requested changes because most things regarding the issue can be done with FileAccess/FileAccessImpl.

try {
Files.createSymbolicLink(targetPath, sourcePath);
LOG.info("Created symbolic link {} -> {}", targetPath, sourcePath);
return;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This return statement is unnecessary because it is the last statement in this method if symlink creation succeeds.

ensureSameVolume(sourcePath, targetPath);

try {
Files.createLink(targetPath, sourcePath);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For file access and operations look into this.context.getFilesAccess().symlink... (FileAccess & FileAccessImpl) because most of the handling of symlinks, junctions and hardlinks is already done there.

With that most of your code becomes obsolete and everything can be shortened.

String msg = fse.getMessage();
if (msg != null) {
String m = msg.toLowerCase();
return m.contains("required privilege")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These contains are not locale safe. E.g. when i run the code on my german machine the error does not get recognized because the message is german.

But as suggested above, this also gets handled by FileAccess of IDEasy.

public final KeywordProperty symbolic;

/** The source path to link to. */
public final StringProperty source;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO it would be better to conform to the syntax and options of the actual ln -s command:
ln -s <target> <link> instead of ln -s <source> <target>

@jakozian jakozian self-requested a review April 24, 2026 12:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Team Review

Development

Successfully merging this pull request may close these issues.

Add ln commandlet to create links

4 participants