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

add completion support (Issue: #454) #460

Merged
merged 7 commits into from
Apr 11, 2019
Merged

add completion support (Issue: #454) #460

merged 7 commits into from
Apr 11, 2019

Conversation

norbusan
Copy link
Collaborator

@norbusan norbusan commented Apr 9, 2019

Add completions for bash and zsh, install them if COMPLETIONS=1
is passed to make. Installation directories can be overridden with
environment variables.

norbusan added 4 commits April 9, 2019 12:14
The only reliable place for zsh functions seems to be
/usr/local/share/zsh/site-functions, independen from installation
prefix. Hard code it, but allow overriding it.
Add remarks how to override the installation directories for
completions to the readme file.
@abraunegg
Copy link
Owner

@norbusan
Need to fix up the Codacy checks

@abraunegg
Copy link
Owner

@norbusan
Something up with the make install part:

(dmd-2.085.0)[alex@centos7full onedrive-pr460]$ sudo make install COMPLETIONS=1
mkdir -p /var/log/onedrive
chown root.users /var/log/onedrive
chmod 0775 /var/log/onedrive
install -D onedrive /usr/local/bin/onedrive
install -D onedrive.1 /usr/local/share/man/man1/onedrive.1
install -D -m 644 logrotate/onedrive.logrotate /etc/logrotate.d/onedrive
for i in README.md README.Office365.md config LICENSE CHANGELOG.md ; do install -D -m 644 $i /usr/local/share/doc/onedrive/$i ; done
mkdir -p /usr/lib/systemd/system/
chown root.root /usr/lib/systemd/system/
chmod 0755 /usr/lib/systemd/system/
install -D -m 644 *.service /usr/lib/systemd/system/
mkdir -p //usr/local/share/zsh/site-functions
install -D -m 644 completions/complete.zsh //usr/local/share/zsh/site-functions/_onedrive
install -D -m 644 completions/complete.bash //usr/local/share/bash-completion/completions/onedrive

completion not installed:

[root@centos7full ~]# cd /usr/share/bash-completion/completions/
[root@centos7full completions]# ls
addpart         colcrt        firewall-cmd          gst-launch-1.0  look         machinectl    nmcli        pvmove       script         svnversion           udevadm       vgimport
appstream-util  colrm         flatpak               gzip            losetup      mbimcli       nsenter      pvremove     scriptreplay   swaplabel            udisksctl     vgmerge
blkdiscard      column        flock                 hexdump         lsblk        mcookie       pacat        pvs          semanage       swapon               ul            vgmknodes
blkid           coredumpctl   fsck                  hostnamectl     lscpu        mdadm         pacmd        pvscan       setarch        systemctl            umount        vgreduce
blockdev        cpio          fsck.cramfs           hwclock         lsinitrd     mergerepo_c   pactl        qmicli       setpriv        systemd-analyze      unshare       vgremove
bootctl         createrepo_c  fsck.minix            ibus.bash       lslocks      mkfs          padsp        quota        setquota       systemd-cat          useradd       vgrename
busctl          ctrlaltdel    fsfreeze              ionice          lsmcli       mkfs.cramfs   paplay       quotacheck   setsebool      systemd-cgls         userdel       vgs
bzip2           curl          fstrim                ip              lvchange     mkfs.minix    parec        quotaoff     setsid         systemd-cgtop        usermod       vgscan
cal             dconf         gapplication          ipcrm           lvcreate     mkswap        parecord     quotaon      setterm        systemd-delta        utmpdump      vgsplit
cfdisk          delpart       gdbus                 ipcs            lvdisplay    mmcli         partx        raw          sfdisk         systemd-detect-virt  uuidgen       wdctl
chage           dmesg         getopt                iptables        lvextend     mock          passwd       readprofile  sqliterepo_c   systemd-nspawn       vgcfgbackup   wget
chcpu           docker        gnome-control-center  isosize         lvm          mockchain     pasuspender  rename       ssh            systemd-run          vgcfgrestore  whereis
chfn            dracut        gresource             journalctl      lvmdiskscan  modifyrepo_c  ping         renice       su             tailf                vgchange      wipefs
chgrp           eject         groupadd              kernel-install  lvreduce     mokutil       pivot_root   repquota     sudo           taskset              vgck          write
chown           fallocate     groupdel              kmod            lvremove     more          prlimit      resizepart   svn            tc                   vgconvert     xz
chpasswd        fdformat      groupmod              ldattach        lvrename     mount         pulseaudio   rev          svnadmin       tcpdump              vgcreate      yum
chrt            fdisk         grub                  localectl       lvresize     mountpoint    pvchange     rpm          svndumpfilter  timedatectl          vgdisplay     yummain.py
chsh            find          gsettings             logger          lvs          namei         pvcreate     rtcwake      svnlook        tracker              vgexport      zramctl
col             findmnt       gst-inspect-1.0       loginctl        lvscan       ndctl         pvdisplay    runuser      svnsync        tuned-adm            vgextend
[root@centos7full completions]# ls onedrive*
ls: cannot access onedrive*: No such file or directory
[root@centos7full completions]# 

@abraunegg
Copy link
Owner

@norbusan
Will be the same issue for uninstall as well:

[alex@centos7full onedrive-pr460]$ sudo make uninstall COMPLETIONS=1
rm -f /usr/local/bin/onedrive
rm -f /etc/logrotate.d/onedrive
rm -f /usr/lib/systemd/system/onedrive*.service
for i in README.md README.Office365.md config LICENSE CHANGELOG.md ; do rm -f /usr/local/share/doc/onedrive/$i ; done
rm -f /usr/local/share/man/man1/onedrive.1
rm -f //usr/local/share/zsh/site-functions/_onedrive
rm -f //usr/local/share/bash-completion/completions/onedrive

@norbusan
Copy link
Collaborator Author

norbusan commented Apr 9, 2019

@abraunegg The bash-completion files is installed into /usr/**local**/share/bash-completion and not /usr/share/bash-completion. If you use PKGCONFIG=1 then the correct setup for the currently installed bash-completion is used, otherwise we do not guess/search for where it is, but install it into $PREFIX.

I think this is the correct method, since

  • bash-completion could be installed into /usr/local, or /opt, we don't know (it is separate from bash!)
  • we don't know how/from where distributions are loading completion files, if at all

With zsh it seems better since zsh devs agreed that in any case they will add /usr/local/share/zsh/site-functions which I am using.

You can override the installation location by setting an env variable as described in README.md.

Does this explain the situation sufficiently?

@abraunegg
Copy link
Owner

Agree - but I think the double // is also an issue ...

@norbusan
Copy link
Collaborator Author

Ok. The double / are no problem, but I removed them anyway. Forgot that we have already a / at the beginning.

@abraunegg abraunegg self-requested a review April 11, 2019 00:05
@abraunegg abraunegg merged commit df39646 into master Apr 11, 2019
@norbusan norbusan deleted the norbert/completion branch April 11, 2019 00:12
@abraunegg abraunegg added this to the v2.3.3 milestone Apr 12, 2019
@lock
Copy link

lock bot commented May 12, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked and limited conversation to collaborators May 12, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants