Skip to content
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

Use shorter shortlinks #689

Merged
merged 3 commits into from
Nov 28, 2018
Merged

Use shorter shortlinks #689

merged 3 commits into from
Nov 28, 2018

Conversation

lblackstone
Copy link
Member

Rather than needing to choose a meaningful name for each "shortlink",
use an alphanumeric 6-character link. Updated README with a command
to generate a link in this format.

Rather than needing to choose a meaningful name for each "shortlink",
use an alphanumeric 6-character link. Updated README with a command
to generate a link in this format.
Copy link

@pulumi pulumi bot left a comment

Choose a reason for hiding this comment

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

🍹 The Update (preview) for stack pulumi/pulumi.io-staging was successful.

Resources:
    44 changes
    + 2 to create
    ~ 41 to update
    - 1 to delete
    506 unchanged

Visit the Pulumi Cloud Console for more information.

Copy link
Contributor

@chrsmith chrsmith left a comment

Choose a reason for hiding this comment

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

Sounds reasonable, but it might be useful to have vanity URLs as well if we have the ability. So maybe just adding a note that you could choose any URL-safe name for the permalink that would work too. But I agree generating one random is easier.

If you expect to be doing this a lot over the coming weeks/months, consider writing a Bash script to just generate the md file as well. e.g. create-short-url.sh "xvd72s" "/reference/toubleshooting.html#...".

@lblackstone
Copy link
Member Author

@chrsmith Added a script and updated the README

Copy link

@pulumi pulumi bot left a comment

Choose a reason for hiding this comment

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

🍹 The Update (preview) for stack pulumi/pulumi.io-staging was successful.

Resources:
    44 changes
    + 2 to create
    ~ 41 to update
    - 1 to delete
    506 unchanged

Visit the Pulumi Cloud Console for more information.

Copy link
Contributor

@chrsmith chrsmith left a comment

Choose a reason for hiding this comment

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

Some nit picks on the Bash script, but if it works feel free to submit it as-is.

@@ -0,0 +1,45 @@
#!/usr/bin/env bash

Copy link
Contributor

Choose a reason for hiding this comment

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

Let's add a big long, comment explaining what this script does.


if [[ $# -ne 2 && $# -ne 3 ]]; then
cat << EOF
Usage: create_short_url.sh <target_link> <filename> [shortlink]
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: If we ever rename the script this would be out of date, $0 can be used instead of create_short_url.sh.

fi

RELATIVEPATH="./shortlinks/${FILENAME}.md"
FILEPATH=$(echo "$(cd "$(dirname "$RELATIVEPATH")"; pwd -P)/$(basename "$RELATIVEPATH")")
Copy link
Contributor

Choose a reason for hiding this comment

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

To cut down on the nested expressions, could we have FOO=$(cd "$(dirname "$RELATIVEPATH")"; pwd -P) and then reference $FOO here instead?

fi

RELATIVEPATH="./shortlinks/${FILENAME}.md"
FILEPATH=$(echo "$(cd "$(dirname "$RELATIVEPATH")"; pwd -P)/$(basename "$RELATIVEPATH")")
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: To be consistent with the rest of the file, we should use ${RELATIVEPATH}, right?

Copy link

@pulumi pulumi bot left a comment

Choose a reason for hiding this comment

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

🍹 The Update (preview) for stack pulumi/pulumi.io-staging was successful.

Resources:
    + 2 to create
    ~ 41 to update
    - 1 to delete
    3 changes. 506 unchanged

Visit the Pulumi Cloud Console for more information.

@lblackstone lblackstone merged commit 05ed9dc into master Nov 28, 2018
@pulumi-bot pulumi-bot deleted the lblackstone/shortlink-update branch November 28, 2018 23:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants